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



Ask a Question

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. thanks. it helped a lot!
View Tutorial          By: lateforbus at 2013-04-25 03:35:24

2. very good
View Tutorial          By: pravin gajbhiye, nagpur at 2010-05-24 01:43:30

3. Thank you very much for this tip.
View Tutorial          By: Lise at 2011-07-15 13:27:23

4. Thank you so much. You made my day. God bless you
View Tutorial          By: Gautam at 2012-09-18 16:24:19

5. Its of the type "Direction"...Enum type
View Tutorial          By: Avinash at 2010-10-29 04:53:35

6. Good one.....
View Tutorial          By: Ratnam.. at 2012-07-03 07:11:26

7. Hello,

A volatile variable does not

View Tutorial          By: aayush at 2009-11-16 07:38:23

8. Hi,
Even if the while loops (in Producer an

View Tutorial          By: Pranay at 2012-09-19 19:08:45

9. Actually, looking at the code, it looks as somethi
View Tutorial          By: Johnson at 2009-07-28 08:14:38

10. @dodo : Overloading is only for parameter types an
View Tutorial          By: sundar at 2010-04-19 02:44:23