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. Many thanks for this tutorial. Exactly what I was
View Tutorial          By: Fedor Emelianenko at 2010-10-28 08:01:17

2. Finally! You enlighted me in a small problem: it w
View Tutorial          By: Fernando Martin at 2011-02-25 12:54:58

3. Great tutorial about ArrayList .It's a very great
View Tutorial          By: umesh sharma at 2009-05-14 20:40:39

4. Thanks a lot for that excellent explanation. It ha
View Tutorial          By: Gregory at 2014-12-30 05:49:21

5. worked for me thanks.
View Tutorial          By: dem125 at 2010-08-03 23:30:32

6. This is a simple app and its working good.......
View Tutorial          By: sathish at 2012-04-23 12:16:07

7. sir very well subject is to continuted the java s
View Tutorial          By: G.venkata siva naga kumar at 2009-11-06 01:13:02

8. A lucid explanantion is "when a method name i
View Tutorial          By: harshnil at 2013-01-15 03:57:44

9. can i use comma operator in simbolic constant in c
View Tutorial          By: Madheswaran at 2011-12-05 18:44:22

10. Can any budy plz send me a source code of Sending
View Tutorial          By: vilas at 2010-03-23 20:38:08