Java Exercise


Back    Next

 

 

Excercise-1: 

1. Open a shell and execute the following commands,

    export PATH=
    export CLASSPATH=

    Write a small java program (say a "Hello World" program) and put it in a directory. Compile the program and change directory to some other directory and try to execute the class file (This will help you to learn about setting PATH/CLASSPATH variables!). 

2.  Write a java program to print the size of different data types in java (list all the data types!).

3.  Write java program to reverse a string using StringBuffer class (do not use String class for data manipulation!)
              a. Input from command line.
              b. Read the input from java program.

4.  Try to learn the difference between String and StringBuffer classes by writing small programs.

5.  Write a class with a package statement in it and try to run it.