1. 程式人生 > 程式設計 >php去除陣列中為0的元素的例項分析

php去除陣列中為0的元素的例項分析

package com.daixng_07;

public class Student {
private String name;
private int age;


//有參構造方法
public Student(String name, int age) {
this.name = name;
this.age = age;
}

//無參構造方法
public Student() {
}

public void setName(String name) {
this.name = name;
}

public String getName() {
return name;
}

public void setAge(int age) {
this.age = age;
}

public int getAge() {
return age;
}

public void show() {
System.out.println(name + "," + age);
}
}
package com.daixng_07;

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

Student s1 = new Student();
s1.setName("大");
s1.setAge(3);
s1.show();

System.out.println("☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:* ☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:*");

Student s2 = new Student("大",3);
s2.show();

}
}


大,3
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:* ☆.。.:*・°☆.。.:*・°☆.。.:*・°☆.。.:*
大,3

Process finished with exit code 0