Wednesday, February 9, 2011

Жишээ код: 3th week

//   Doorh jishee code ni class, gishuun function, gishuun 
//   ugugdul, baiguulagch function herhen ashiglah tuhai
//   uzuulne.
//   ajluulahdaa
//   javac lab01.java
//   java lab01

class Student {
public String Ovog;
public String Ner;
Student (String First, String ner){
Ovog=First;  
Ner=ner;  
}
Student()
{}

Student (String ovog){
Ovog=ovog;
}
public String OvgiigDuud()
{ 
return Ovog;
}
public String getNer()
{
return Ner;
}

}
public class lab01 {
public static void main (String args[]){

Student oyutan = new Student ();
oyutan.Ovog="Dorj";
oyutan.Ner="Bataa";

Student oyutan2= new Student ("Dorj", "Bataa");
Student oyutan3= new Student ("Dorj");

System.out.println("Oyutanii ovog: "+oyutan.OvgiigDuud()+"\nOyutanii ner "+oyutan.getNer());
}
}


No comments:

Post a Comment