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. The example shown and ur way of explaining is good
View Tutorial          By: Devi at 2009-02-24 07:19:26

2. i have been trained in java stream. But i dont kno
View Tutorial          By: savio at 2013-01-23 10:15:51

3. while i am executing this program i am getting Nul
View Tutorial          By: Seema at 2013-11-26 18:39:15

4. I am not able to open the rar file, can you please
View Tutorial          By: Chandra at 2008-08-07 10:35:59

5. Hi,

I think this is not a correct d

View Tutorial          By: Dinesh Chopra dc at 2013-03-19 04:30:48

6. so good .to give easy understand
View Tutorial          By: ashok .my no 9618738732 at 2010-02-15 06:19:48

7. this code is very and help in our project BUT
View Tutorial          By: bhamre sandeep at 2010-02-28 03:02:53

8. Hi Prathamesh,
Maybe the COM port to which

View Tutorial          By: Ramlak at 2007-03-19 00:46:49

9. Thanks it did help to get complete clarity
View Tutorial          By: Vivek The Great at 2012-05-07 17:31:32

10. "For example, float can be useful when repres
View Tutorial          By: rangzen at 2014-03-28 09:31:47