能帮我再看下这三个Java代码吗
1、//Example1.javapackagebao1;publicclassExample1{publicvoidshow(){System.out.println(...
1、//Example1.java
package bao1;
public class Example1{
public void show() {System.out.println("DsiplayExample1!"); }
}
//Example2.java
package bao1;
public class Example2{
public void show() {System.out.println("DsiplayExample2!"); }
}
//JavaApp.java
import bao1.Example1;
import bao1.Example2;
public class JavaApp{
publicstatic void main(String [] args){ Example1 E1=new Example1();
Example1 E1=new Example2();
E1.show; E2.show;
}
2、abstract class A{
int a; A(){ System.out.println("A:A()"); }
void test(){ System.out.println("A:test()");
}
abstract void test01(); }
public class AnonyDemo{
A getChildOfA(){
return new A(){
int b;
void test01(){
System.out.println("insidetest01()");
} };
public static void main(String args[]){
AnonyDemo d=new AnonyDemo();
A t=d.getChildOfA();
t.test();
t.test01(); } }
3、import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JPasswordFieldDemoextends JApplet
implements ActionListener{
JLabel jl1,jl2;
JPasswordField jp1,jp2;
JButton jb1,jb2;
public void init(){
Container c = getContentPane();
jl1 = new JLabel("
请输入您的密码:" ,JLabel.CENTER);
jl2 = new JLabel("
请再次输入密码:" ,JLabel.CENTER); jp1= new JPasswordField(8); jp2 = new JPasswordField(8); jb1 = newJButton("
提交"); jb2 = newJButton("
取消"); c.setLayout(new GridLayout(3,2)); c.add(jl1); c.add(jp1); c.add(jl2); c.add(jp2); c.add(jb1); c.add(jb2); jb1.addActionListener(this); jb2.addActionListener(this); } }
帮忙注释下 展开
package bao1;
public class Example1{
public void show() {System.out.println("DsiplayExample1!"); }
}
//Example2.java
package bao1;
public class Example2{
public void show() {System.out.println("DsiplayExample2!"); }
}
//JavaApp.java
import bao1.Example1;
import bao1.Example2;
public class JavaApp{
publicstatic void main(String [] args){ Example1 E1=new Example1();
Example1 E1=new Example2();
E1.show; E2.show;
}
2、abstract class A{
int a; A(){ System.out.println("A:A()"); }
void test(){ System.out.println("A:test()");
}
abstract void test01(); }
public class AnonyDemo{
A getChildOfA(){
return new A(){
int b;
void test01(){
System.out.println("insidetest01()");
} };
public static void main(String args[]){
AnonyDemo d=new AnonyDemo();
A t=d.getChildOfA();
t.test();
t.test01(); } }
3、import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JPasswordFieldDemoextends JApplet
implements ActionListener{
JLabel jl1,jl2;
JPasswordField jp1,jp2;
JButton jb1,jb2;
public void init(){
Container c = getContentPane();
jl1 = new JLabel("
请输入您的密码:" ,JLabel.CENTER);
jl2 = new JLabel("
请再次输入密码:" ,JLabel.CENTER); jp1= new JPasswordField(8); jp2 = new JPasswordField(8); jb1 = newJButton("
提交"); jb2 = newJButton("
取消"); c.setLayout(new GridLayout(3,2)); c.add(jl1); c.add(jp1); c.add(jl2); c.add(jp2); c.add(jb1); c.add(jb2); jb1.addActionListener(this); jb2.addActionListener(this); } }
帮忙注释下 展开
1个回答
展开全部
//定义抽象类
abstract class A{
int a;
A(){ System.out.println("A:A()"); }
void test(){ System.out.println("A:test()");
}
//定义抽象方法
abstract void test01();
}
public class AnonyDemo{
A getChildOfA(){
return new A(){
int b;
void test01(){
System.out.println("insidetest01()");
} };
public static void main(String args[]){
AnonyDemo d=new AnonyDemo();
A t=d.getChildOfA();
t.test();
t.test01(); } }
//导包
3、import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
//定义JPasswordFieldDemo,继承JApplet类,实现ActionListener接口
public class JPasswordFieldDemo extends JApplet
implements ActionListener{
//声明变量 ,多个面板控件
JLabel jl1,jl2;
JPasswordField jp1,jp2;
JButton jb1,jb2;
public void init(){
//声明面板容器
Container c = getContentPane();
//实例化JLabel
jl1 = new JLabel("
请输入您的密码:" ,JLabel.CENTER);
jl2 = new JLabel("
请再次输入密码:" ,JLabel.CENTER); jp1= new JPasswordField(8); jp2 = new JPasswordField(8); jb1 = newJButton("
提交"); jb2 = newJButton("
取消");
//把面板控件加入到面板
c.setLayout(new GridLayout(3,2)); c.add(jl1); c.add(jp1); c.add(jl2); c.add(jp2); c.add(jb1); c.add(jb2); jb1.addActionListener(this); jb2.addActionListener(this); } }
abstract class A{
int a;
A(){ System.out.println("A:A()"); }
void test(){ System.out.println("A:test()");
}
//定义抽象方法
abstract void test01();
}
public class AnonyDemo{
A getChildOfA(){
return new A(){
int b;
void test01(){
System.out.println("insidetest01()");
} };
public static void main(String args[]){
AnonyDemo d=new AnonyDemo();
A t=d.getChildOfA();
t.test();
t.test01(); } }
//导包
3、import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
//定义JPasswordFieldDemo,继承JApplet类,实现ActionListener接口
public class JPasswordFieldDemo extends JApplet
implements ActionListener{
//声明变量 ,多个面板控件
JLabel jl1,jl2;
JPasswordField jp1,jp2;
JButton jb1,jb2;
public void init(){
//声明面板容器
Container c = getContentPane();
//实例化JLabel
jl1 = new JLabel("
请输入您的密码:" ,JLabel.CENTER);
jl2 = new JLabel("
请再次输入密码:" ,JLabel.CENTER); jp1= new JPasswordField(8); jp2 = new JPasswordField(8); jb1 = newJButton("
提交"); jb2 = newJButton("
取消");
//把面板控件加入到面板
c.setLayout(new GridLayout(3,2)); c.add(jl1); c.add(jp1); c.add(jl2); c.add(jp2); c.add(jb1); c.add(jb2); jb1.addActionListener(this); jb2.addActionListener(this); } }
追问
好吧,谢谢
来自:求助得到的回答
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询