0% found this document useful (0 votes)
3 views2 pages

Java Lab Answers

The document contains a series of questions and answers related to Java programming concepts, including syntax, variable naming, case sensitivity, and mathematical operations. It also discusses the use of specific functions and methods, such as substring and Scanner for user input. Overall, it serves as a brief overview of fundamental Java programming principles and practices.

Uploaded by

sudiii1st
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)
3 views2 pages

Java Lab Answers

The document contains a series of questions and answers related to Java programming concepts, including syntax, variable naming, case sensitivity, and mathematical operations. It also discusses the use of specific functions and methods, such as substring and Scanner for user input. Overall, it serves as a brief overview of fundamental Java programming principles and practices.

Uploaded by

sudiii1st
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

Question 1.

[Link]("I like Java.");


[Link]("You like tea.");

Question 2.
public class HelloWorld {
public static void main(String[] args) {
[Link]("Hello World!");
}
}

Question 3.
Valid: rate1, TimeLimit, numberOfWindows
Invalid: 1stPlayer, [Link], long

Question 4.
Yes, Java is case-sensitive.

Question 5.
int feet = 0, inches = 0;

Question 6.
interest = balance * rate;

Question 7.
Output:
b
c
c

Question 8.
(1/3) * 3 is equal to 0.0

Question 9.
Correct: fahrenheit = (9.0 / 5) * celsius + 32.0;

Question 10.
Output:
3
3
Question 11.
n == 3

Question 12.
double bmi = weight / (height * height);

Question 13.
Candy bars = coupons / 10; Gumballs = remaining / 3;

Question 14.
Use substring and toUpperCase for Pig Latin conversion.

Question 15.
Use constants, proper naming, and formatting.

Question 16.
weight = 110 + (extra inches * 5);

Question 17.
drinks = 10000 / caffeinePerDrink;

Question 18.
Use Scanner to input two numbers and print difference.

Question 19.
If age >= 18 → Eligible else Not eligible.

You might also like