1.
What is Java’s character type, and how does it differ from the character type used by
some other programming languages?
2. Show how a short-circuit AND can be used to prevent a divide-by-zero error.
3. What is inner class? Explain with suitable example.
4. What is a namespace? Why is it important that Java allows you to partition the
namespace?
5. Explain the two ways that the members of a package can be accessed by other Packages
with suitable example
6. Math.random( ) is a method in the Java library that computes a random double value
between 0 and 1. For example, the statement double x = Math.random(); assigns to the
variable x a random double between 0 and 1. Write a program that tests how well
Math.random( ) works. More precisely, write a program that calls Math.random( )
1,000 times to create 1,000 values, keeping track of how many of them are greater than
0.5, and then prints out the result. Your program should theoretically print out a number
very close to 500.
7. Create a method max( ) that has three integer parameters x, y, and z and it returns the
largest of the three. Do it two ways: once using an if-else-if ladder and once using nested
if statements.
8. List and illustrate different String Methods with examples.