This is a sample code for if-else statements in Java.
import java.io.*;
class IfElseExa
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
System.out.println("Grade your self between 1-10");
int grade=Integer.parseInt(br.readLine());
if(grade<10)
{
System.out.println("So you graded yourself, "+(10-grade)+ " lesser than 10 ???");
}
else
{
System.out.println("Now, that is what I call confidence !!! Wel done buddy !!!");
}
}
}
No comments:
Post a Comment