Sunday, 15 July 2007

Java Fundamentals (part 9)

Exercises and Self Test Questions


Exercise 1 - 3 Using the API Documentation



  • Find the println method description in the System class


Exercise 1 - 4 Create another simple Java application



  • Create an application that prints the following 3 strings on separate lines: “Why am I doing this” , “I must be mad”, “Java is .....”
  • Compile and run the program


The Menu Applet



  1. Create an applet called MyMenu that displays the following text in the applet:

    1. Print first string
    2. Print second string
    3. And now print the third string



  • Now create a simple html file that will display the applet. Make the applet size 300 by 400
  • Use Appletviewer to display the applet
  • Now use your desired internet browser to display the
    applet

Self Test Question



  1. Is Java compiled or interpreted? Why?
  2. If you create an application on an Apple Macintosh machine, can you run the same program on a Sun Solaris platform? Why?
  3. What does the term “Garbage Collection” mean?
  4. What does the class loader do? What about the bytecode verifier?
  5. What is wrong with this code snippet?

    Public class BadClass{
    Public void main(string args){


    }
    }


  6. What language does Java resemble most closely?

No comments:

Post a Comment