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 work. Although it would be nicer if you can p
View Tutorial          By: frisked09 at 2011-05-26 23:52:34

2. Where should I put the xml file ??????????
View Tutorial          By: Marya at 2014-03-21 16:01:13

3. hi.I am new in j2me and really want to learn more
View Tutorial          By: A.vinothKumar at 2012-08-20 07:50:26

4. I have use the above code, Am getting the below er
View Tutorial          By: RameshKumar at 2011-07-25 05:02:12

5. hi,
please anyone tell me how to send bulk

View Tutorial          By: Nasrin at 2012-10-21 18:59:50

6. good
View Tutorial          By: qwerty at 2014-02-14 07:37:08

7. Really nice explanation...
nice to understa

View Tutorial          By: Parth Kansara at 2011-06-21 02:11:52

8. hi i want to run a c program in java program but i
View Tutorial          By: jyothi at 2014-11-27 06:40:27

9. i want ask whether how do i run the application?
View Tutorial          By: unknown at 2009-10-29 21:13:03

10. Very good example with explaination and sample cod
View Tutorial          By: plenitude at 2010-04-15 23:55:02