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. Thx for the explanation, I understand what recursi
View Tutorial          By: Tina at 2008-12-15 16:39:27

2. answers to the questions asked by ranjan in commen
View Tutorial          By: A Sadist at 2012-07-05 12:13:45

3. Sencillo y directo. No se podía explic
View Tutorial          By: Eligio at 2013-09-03 05:26:35

4. i got really nice help from the code. Thanks.
View Tutorial          By: Amit at 2009-04-10 08:18:40

5. the best explaination
View Tutorial          By: kingh at 2010-09-17 04:06:46

6. Hello, your post helped me a lot with solving my o
View Tutorial          By: Florian Brunner at 2008-06-26 08:59:42

7. A wonderful tutorial to learn XML Processing with
View Tutorial          By: Madhan at 2011-09-13 19:37:08

8. How can I save the canvas edited by the user from
View Tutorial          By: pavan at 2014-10-14 08:26:55

9. Different from the others,Good One
View Tutorial          By: Amiiiii java slayer at 2009-10-14 08:10:26

10. I did not understand it. please give one example e
View Tutorial          By: farhaan at 2008-03-20 12:06:11