Comment on Tutorial - Using read() to read one character at a time from console input By Jagan



Comment Added by : Nitish

Comment Added at : 2013-01-25 04:06:38

Comment on Tutorial : Using read() to read one character at a time from console input By Jagan
package alphabets;

import java.util.Scanner;

/**
*
* @author User
*/
class Alphabets
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
char ch1,ch2;
ch1 = input.next().charAt(0);
ch2 = input.next().charAt(0);
System.out.println("Your Frist Character is: "+ch1);
System.out.println("Your Second Character is: "+ch2);
boolean flag = true;
if(ch1 == ch2)
{
System.out.println(flag);
}
else
{
flag = false;
System.out.println("Character did not match "+flag);
}
}
}


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. I tried ....so this is best solution for understa
View Tutorial          By: rehnuma at 2015-03-30 12:29:38

2. Very good explanation . I was very confuse but rea
View Tutorial          By: Shahabaj at 2010-08-10 08:58:39

3. hiii frds i want to run this program can i run usi
View Tutorial          By: arun kumar ojha at 2011-07-20 00:59:10

4. In your AndroidManifest.xml file you will have to
View Tutorial          By: Ashley at 2011-07-21 02:47:49

5. Okay, I have implemented this and it works, except
View Tutorial          By: Matthew at 2009-06-16 13:08:48

6. It is clear and understandable for beginners.

View Tutorial          By: Archana at 2011-12-14 12:31:21

7. Nice basics. Very helpful
View Tutorial          By: Gorav at 2011-11-11 12:46:28

8. very useful. Thx
View Tutorial          By: reddy at 2015-05-07 09:58:19

9. Thanks. But I've also had to use $JAVA_HOME/jre/li
View Tutorial          By: Alex at 2010-03-15 04:17:09

10. i have downloaded the code and calling the the SMS
View Tutorial          By: sandeep das at 2009-04-09 11:12:16