Illustrate - //of the instance and static variables....

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Illustrate { private int x; private static int y; public static int count; //Default constructor //Postcondition: x = 0 public Illustrate() { x = 0; } //Constructor with parameters //Postcondition: x = a public Illustrate(int a) { x = a; } //Method to set x. //Postcondition: x = a void setX(int a) { x = a; } //Method to return the values of the instance //and static variables as a string. //The string returned is used by the methods //print, println, or printf, to print the values
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: //of the instance and static variables. //Postcondition: The values of x, y, and count //are returned as a string. public String toString() { return("x = " + x + ", y = " + y + ", count = " + count); } //Method to increment the value of the private //static member y. //Postcondition: y is incremented by 1. public static void incrementY() { y++; } }...
View Full Document

This note was uploaded on 06/17/2011 for the course COMP 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Ask a homework question - tutors are online