Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

flow control statements in java

if else
while
do while
switch
break
eg 1:largest number
public class Largest{
public static void main(String args[])
{
Scanner input=new Scanner(System.in);
int a=input.nextInt();
int b=input.nextInt();
int c=input.nextInt();
int max=a;
if(b>max){
max=b;
}
if(c>max){
max=c;
}
}
}

eg:2 casecheck
import java.util.scanner;
public class Casecheck{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
char in=in.next().trim().charAt(0);// it is for
character input
if(ch>='a' && ch<='z'){
System.out.println("Lowercase");
}
else{
System.out.println("uppercase");
}
}
}

You might also like