十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
public class Student {
创新互联建站主营襄垣网站建设的网络公司,主营网站建设方案,App定制开发,襄垣h5微信小程序开发搭建,襄垣网站营销推广欢迎襄垣等地区企业咨询
private String name;
private String number;
private int score;
public Student() {
}
public Student(String name, String number, int score) {
super();
this.name = name;
this.number = number;
this.score = score;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String toString() {
return "Name: " + name
+ ",Number: " + number
+ ",Score : " + score;
}
//调用方法
public static void main(String[] args) {
Student s = new Student("Jack","123456",98);
System.out.println(s.toString());
}
}
运行结果:
Name: Jack,Number: 123456,Score : 98
下面是一个java 小程序实现的\x0d\x0aimport java.awt.*;//引入包\x0d\x0aimport java.applet.Applet;//引入包\x0d\x0apublic class Output extends Applet//定义类\x0d\x0a{\x0d\x0a //定义变量\x0d\x0a private String name;\x0d\x0a private int num;\x0d\x0a //初始化\x0d\x0a public void init()\x0d\x0a {\x0d\x0a name = getParameter("vname");\x0d\x0a num = Integer.parseInt(getParameter("vnum"));\x0d\x0a }\x0d\x0a //输出\x0d\x0a public void paint(Graphics g)\x0d\x0a {\x0d\x0a g.drawString ("姓名:"+name+";学号:"+num,20,30);\x0d\x0a }\x0d\x0a}\x0d\x0a\x0d\x0a相应的html文件\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test222 {
public static void main(String[] args) throws IOException {
int i, j;
String a;
BufferedReader str = new BufferedReader(
new InputStreamReader(System.in));
System.out.println("请输入学号:");
a = str.readLine();
System.out.println("学号为:" + a);
str = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入姓名:");
a = str.readLine();
System.out.println("姓名为:" + a);
}
}
望采纳~~
这个比较简单,我说一下方法,你打开eclipse,新建一个项目,然后在src里面新建一个学生类,后面的一步一步走,那步不懂就问