public class Hassan {
int a = 0;
double b = 0.0;
String s = "Hello world";
public Hassan(int a){
this.s = "this is int";
}
public Hassan(double b){
this.s = "this is double";
}
public void shows(){
System.out.println(s);
}
public static void main(String[] args) {
// TODO 自动生成的方法存根
Hassan h1 = new Hassan(100);
h1.shows();
Hassan h2 = new Hassan(100.0);
h2.shows();
}
}
运行结果:
this is int
this is double
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [util.c:840]