0% found this document useful (0 votes)
3 views1 page

Java Exam Answers

The document provides answers to a Java exam covering logical operators, math constants, input reading using Scanner, and drawing methods in graphics. It explains the use of logical operators like AND, OR, and NOT, and details math constants such as Math.PI and Math.E. Additionally, it outlines applet lifecycle methods and drawing functions like drawOval and fillOval.

Uploaded by

azizadana3
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 views1 page

Java Exam Answers

The document provides answers to a Java exam covering logical operators, math constants, input reading using Scanner, and drawing methods in graphics. It explains the use of logical operators like AND, OR, and NOT, and details math constants such as Math.PI and Math.E. Additionally, it outlines applet lifecycle methods and drawing functions like drawOval and fillOval.

Uploaded by

azizadana3
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

JAVA EXAM ANSWERS

1(a) Logical operators are symbols used to combine or modify boolean expressions. They help in
decision making.

1(b) AND (&&): true if both are true. OR (||): true if one is true. NOT (!): reverses result.

1(c) Example: if(age >=18 && hasID) { [Link]('Allowed'); }

2(a) Math constants are fixed values in Java Math class. They improve accuracy and save time.

2(b) [Link] = 3.14159, used for circles. Math.E = 2.718, used in exponential calculations.

2(c) Circumference = 2 * [Link] * radius

3(a) Scanner reads input: nextLine() for String, nextInt() for int, nextDouble() for decimal.

4(a) drawOval() draws circle outline, drawPolygon() draws triangle.

4(b) drawOval() outline only, fillOval() fills shape.

5 Applet methods: init(), start(), stop(), destroy().

You might also like