第三次java

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第三次java相关的知识,希望对你有一定的参考价值。

class Employee{
int number;
String name;
int xinshui;
int zengzhang;
public void tell(){
System.out.println("编号:"+number+",姓名:"+name+",薪水:"+xinshui+",增长:"+zengzhang+",工资:"+(zengzhang+xinshui));
}
}
public class dier{
public static void main(String args[]){
Employee per=new Employee();
per.number=140201128;
per.name="辽宁";
per.xinshui=3000;
per.zengzhang=1000;
per.tell();
}
}

 

 

 

 

 

class Dog{
private String name;
private String color;
private int age;
public Dog(String name,String color,int age){
this.setName(name);
this.setColor(color);
this.setAge(age);
}
public void tell(){
System.out.println("名字:"+name+",颜色:"+color+",年龄:"+age);
}
public String getName(){
return name;
}
public void setName(String a){
name=a;
}
public String getColor(){
return color;
}
public void setColor(String b){
color=b;
}
public int getAge(){
return age;
}
public void setAge(int c){
age=c;
}
}
public class disi{
public static void main(String args[]){
Dog per=new Dog("大黄","黄",3);
per.tell();
}
}

 

 

 

 

class User{
private String name;
private String cdk;
private int num;
public User(){}
public User(String name){
this.setName(name);
}
public User(String name,String cdk){
this.setName(name);
this.setCdk(cdk);
}
public void tell(){
System.out.println("名字:"+name+",口令:"+cdk+",个数:"+num);
}
public String getName(){
return name;
}
public void setName(String a){
name=a;
}
public String getCdk(){
return cdk;
}
public void setCdk(String b){
cdk=b;
}
public int getNum(){
return num;
}
public void setNum(int c){
num=c;
}
}
public class diwu{
public static void main(String args[]){
User per=new User("LinXinHua","lxh",3);
per.tell();
}
}

 

 

 

class Address{
String country;
String shengfen;
String city;
String jiedao;
int youbian;
public void tell(){
System.out.println("国家:"+country+",省份:"+shengfen+",城市:"+city+",街道:"+jiedao+",邮编:"+youbian);

}
public class diyi{
public static void main(String args[]){
Address per=new Address();
per.country="中国";
per.shengfen="辽宁";
per.city="沈阳";
per.jiedao="沈北新区";
per.youbian=11300;
per.tell();
}
}

以上是关于第三次java的主要内容,如果未能解决你的问题,请参考以下文章

第三次Scream冲刺

第三次作业

第三次冲刺

第三次作业

第三次作业

第三次作业