0% found this document useful (0 votes)
5 views3 pages

JAVA4PRIYANKA

Uploaded by

Priyanka Thadke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

JAVA4PRIYANKA

Uploaded by

Priyanka Thadke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Name: Priyanka Khandu Thadke

Class:CO4I(A) Roll no:85

Practical no:- 4 Develop programs to demonstrate use of switvh-case statement and


conditional if(? :)

Practical Related Questions:

Q.4)writea program to make use of ternary operator.

class Num

public static void main(String args[])

int x=100;

if(x==100?50:70)

system.out.println("value of x is:"+x);

else

system.out.println("value of x is:"+x);

Output:

Exersise:

Q.2)write any program to check switch-case Statement.


import java.util.*;

class SwitchCase

public static void main(String args[])

Scanner sc=new Scanner(System.in);

System.out.println("Enter your choice:");

int ch=sc.nextInt();

switch(ch)

case 1:

System.out.println("Monday");

break;

case 2:

System.out.println("Tuesday");

break;

case 3:

System.out.println("Wednesday");

break;

case 4:

System.out.println("Thursday");

break;

case 5:

System.out.println("Friday");

break;

case 6:
System.out.println("Saturday");

break;

case 7:

System.out.println("satuday");

break;

OutPut:

You might also like