怎么这么多public class myexample程序写的怎么这么夸张呀.public class example {
String st1;
private int a1;
public example(string st1 ,int a1) {
this.st1=st1;
this.a1=a1;
}
public void print(){
system.out.printin(st1+a1);
}public static void main(string[] args){
example hello=new example("hello,world!",999);//**********
hello.print;
}
}
String st1;
private int a1;
public example(string st1 ,int a1) {
this.st1=st1;
this.a1=a1;
}
public void print(){
system.out.printin(st1+a1);
}public static void main(string[] args){
example hello=new example("hello,world!",999);//**********
hello.print;
}
}
String st1;
private int a1; public example(String st1 ,int a1) {
this.st1=st1;
this.a1=a1; }
public void print(){
System.out.println(st1+a1);
}
}myexample.javapublic class myexample{
public static void main(String[] args){
example hello=new example("hello,world!",999);//**********
hello.print();
}
}
是正确的
但是至少有20处不符合java 编码规范!!!!!
1.只能有一个类为public而且该类名为文件名,同时是运行的类(一般是有main函数的类);
2.Java取分大小写,否则出错;
3.函数与变量的调用不同,函数肯定有()、变量肯定没有();
4.编码太不规范,这是最要不得的。
那么在jbuilder6中怎么像visual c++那样运行c的源代码呢?
应该这么写:hello.print();
你可以右击该文件,选择run
运行后,在消息窗口(Message pane)中能看到结果。