constructir

constructir

how to create a constructor to set the month using the first three letters in the name of
the month as three arguments
View Answers

February 26, 2010 at 10:29 PM

public class Month {

char char_1;
char char_2;
char char_3;

Month(char one,char two,char three){
this.char_1 = one;
this.char_2 = two;
this.char_3 = three;
}
public static void main(String[] args) {
Month month = new Month('j','a','n');
System.out.println(""+month.char_1+month.char_2+month.char_3);
}

}









Related Tutorials/Questions & Answers:
constructir - Java Beginners

Ads