Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
1. Consider the following class:public class IdentifyMyParts { public static int x = 7; public int y = 3; }a. How many class variables does theIdentifyMyParts
class contain? What are their names?b. How many instance variables does the
IdentifyMyParts
class contain? What are their names?c. What is the output from the following code:
IdentifyMyParts a = new IdentifyMyParts(); IdentifyMyParts b = new IdentifyMyParts(); a.y = 5; b.y = 6; a.x = 1; b.x = 2; System.out.println("a.y = " + a.y); System.out.println("b.y = " + b.y); System.out.println("a.x = " + a.x); System.out.println("b.x = " + b.x);
1. Write a class whose instances represent a playing card from a deck of cards.
2. Write a class whose instances represents a deck of cards.
3. Write a small program to test your deck and card classes. The program can be as simple as creating a deck of cards and displaying its cards.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2001 Sun Microsystems, Inc. All rights reserved.