Suggested Projects


Skill-Building Exercises

  1. Compiling A Simple Class:   Create an application named MyClass. Include a main() method but leave its body empty. Compile and run the class.

  2. Add Functionality To MyClass:   Add a statement to the main() method of MyClass that prints a short text message to the console.

  3. Add Variables To MyClass:   Add several variables to the main() method of MyClass. Declare one variable for each type of primitive data type. Initialize them to any value you deem necessary and print their values to the console using the System.out.println() method.

  4. Read Input Into Your Program From The Command Line:   Using the main() method’s String parameter write a program that reads five Strings from the command line and converts them to float types. Declare five float variables to hold the converted values. Use the services of the wrapper class Float’s parseFloat() method to perform the conversion. Add the five float values together and print their total to the console. (Use example 6.11 as a guide.)

  5. Research:   Explore the functionality provided by the primitive type wrapper classes. Pay particular attention to the Character class. Write a description of each class constant and method explaining its purpose and function.

  6. Java Primitive Type Value Ranges:   Write a program that prints out the minimum and maximum values that can be stored in the primitive data types. (Hint: Look to the functionality provided by the wrapper classes.)

  7. Add Static Variables To MyClass:   Add one or two static class variables to MyClass. Access them via the main() method and change their values. Print their values to the console after each change. Change their values at least three times.

  8. Add Instance Variables To MyClass:   Add one or more instance variables to MyClass. Create an instance of MyClass in the main() method using the new operator. Access each instance variable via the reference variable you created and change their value. Print their values to the console after each value change.

  9. Add Class And Instance Constants To MyClass:   Add one or more class and instance constants to MyClass and access them via the main() method. Print their values to the console.

  10. Use Different Operators In Programs:   Explore the functionality provided by different Java operators. Use the following Java operators in your MyClass program: -, *, \, &&, ||, <<. >>, >>>, %, instanceof, !, ~. Note the effects of using these operators.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net