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



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. Saved my life!
View Tutorial          By: Sahil Nair at 2013-09-21 09:26:54

2. Never use gets for taking inputs from users. Your
View Tutorial          By: Aneesh Dogra at 2012-07-20 04:08:32

3. If you use comments you will have better idea abou
View Tutorial          By: Mohammed Homam at 2009-12-06 04:43:51

4. can you clearly reveal how to create crystal repor
View Tutorial          By: halim at 2011-07-02 00:28:48

5. Thnks, such a basic example to understand. Keep it
View Tutorial          By: Pradeep Singh at 2012-10-11 04:24:54

6. Dude, u xplaining lyk u already telling pros!Pls t
View Tutorial          By: Brianjambo at 2009-04-14 06:32:13

7. if the simple example with syntex than very easy t
View Tutorial          By: Rikunj suthar at 2011-08-31 06:57:17

8. Helps very much. Thank you.
View Tutorial          By: Uwe at 2010-08-17 12:35:44

9. thanks a lot it was really helpful...........for d
View Tutorial          By: Joshi Rocky at 2010-01-29 14:13:40

10. Very nice introduction to j2me well you should als
View Tutorial          By: Bikashjit at 2012-08-29 08:53:28