Exercises

Bruce Eckel's Thinking in Java Contents | Prev | Next

  1. Write a method that takes an object and recursively prints all the classes in that object’s hierarchy.
  2. In ToyTest.java, comment out Toy’s default constructor and explain what happens.
  3. Create a new type of collection that uses a Vector. Capture the type of the first object you put in it, and then allow the user to insert objects of only that type from then on.
  4. Write a program to determine whether an array of char is a primitive type or a true object.
  5. Implement clearSpitValve( ) as described in this chapter.
  6. Implement the rotate(Shape) method described in this chapter, such that it checks to see if it is rotating a Circle (and, if so, doesn’t perform the operation).
^



Comments

  • There are no comments yet. Be the first to comment!

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds