Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

constructir

Ads

 
 

Share on Google+Share on Google+

sheila
constructir
1 Answer(s)      7 years 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
Ads
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);
}

}

Ads









Related Tutorials/Questions & Answers: