Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sheila
constructir
1 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners


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

Advertisement
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:
 

 

 

DMCA.com