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. Good Luck....
View Tutorial          By: nagarajan at 2011-06-19 03:55:49

2. Excellent information reg the scopes of jsp , plea
View Tutorial          By: venkateshwarreddy suravaram at 2012-01-09 08:34:23

3. thank's
View Tutorial          By: gerald at 2010-08-06 01:21:39

4. Awesome article. It's very useful. Despite it didn
View Tutorial          By: Matheus at 2015-02-24 12:06:05

5. how do i write the above same code using ajax and
View Tutorial          By: Karthik at 2011-08-29 11:21:45

6. hai

Please show ByteAraayOutputStre

View Tutorial          By: WebMayuri at 2010-02-10 22:30:01

7. i want to know about basic requirement for jdbc ,
View Tutorial          By: Amit sharma at 2009-03-19 04:10:24

8. send c++ programs on every topic of c++
View Tutorial          By: mandeep at 2009-07-11 00:50:23

9. Yesu. Thenk a u vely muchos. HURRRRR
View Tutorial          By: hurr durr at 2013-09-19 19:50:23

10. Excellent!!!!! Thanks
View Tutorial          By: nimbostratue at 2009-12-09 13:07:09