java题!
Java code:
package f;
public class TestStudent {
public static void main(String[] args) {
Student s1 = new Student();//创建父类对象
Xue x1 = new Xue();//创建子类对象;
s1.Set("张三 ", "男 ");
s1.Set(18);
s1.Set(88.8);
System.out.println(s1.Info());
x1.Set("李四 ","男 ");
x1.Set("厨师");
x1.Set(18);
x1.Set(99.9);
System.out.println(x1.Info());
Student s2 = new Xue();
s2.Set("小王","女");
s2.Set(26);
s2.Set(33.3);
}
}
class Student{ //父类
String name;
String xingbie;
int age;
double chengji;
public void Set(String name,String xingbie){
this.name = name;
this.xingbie = xingbie;
}
public void Set(int age){
this.age = age;
}
public void Set(double chengji){
this.chengji = chengji;
}
public String GetName(){
return name;
}
public String GetXingBie(){
return xingbie;
}
public int GetAge(){
return age;
}
public double GetChengJi(){
return chengji;
}
public String Info(){
return "名字:" + name + "性别:" + xingbie + "年龄:" + " " + age + " " + "成绩:" + chengji;
}
}
class Xue extends Student{ //子类 集成了父类
String zhiwu;
public void Set(String zhiwu){
this.zhiwu = zhiwu;
}
public String GetZhiWu()
相关问答:
不知道是什么原因,我该如何处理,请大虾们指教了,小弟在此谢过。。。。
错误信息如下:
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context t ......
我在jsp页面存上一个session,本页面还可以取出值来.
但是一刷新,或者打开新的页面就取不出值来了.
奇怪的是,我测试另一个程序时候
在jsp页面存上一个session,本页面可以取出值来,刷新或打开新页面值能取出来了.
......
我想做够购物车用session 但是不知道怎么获取购买数量 谁有具体的代码吗 希望能割舍
下面是购物车的核心代码
有了这个 就应该能够做出来吧
Java code:
public void doPost(HttpServletRequest reque ......
我想使用Lucene的代码,发现要import一批文件:
============
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
………………
===== ......
比如一个JButton控件,如何把它的值(假设为1)传到JTextField上并显示出来,并且把JButton的值送给一个变量
(我知道要用监听器,但是事件发生后处理的方法怎么写不知道)
望各位大侠指教!
比如要修改的JTe ......