0% found this document useful (0 votes)
12 views

Conditional Questions

Uploaded by

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

Conditional Questions

Uploaded by

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

CONDITIONAL STATEMENTS QUESTIONS

[email protected]
Question 1 : Write a Java program to get a number from the user and print whether it is
positive or negative.

Question 2 : Finish the following code so that it prints You have a fever if your temperature
is above 100 and otherwise prints You don't have a fever.

public class Solution {


public static void main(String[] args) {
double temp = 103.5;
}
}

Question 3 : Write a Java program to input week number(1-7) and print day of week name
using switch case.

Question 4 : What will be the value of x & y in the following program:


public class Solution {
public static void main(String args[]) {
int a = 63, b = 36;
boolean x = (a < b ) ? true : false;
int y= (a > b ) ? a : b;
}
}

Question 5 : Write a Java program that takes a year from the user and print whether that
year is a leap year or not.

Hint:
[email protected]

You might also like