// 创建方法内部类的对象
MInner mi=new MInner();
// 调用内部类的方法
int newScore=mi.getScore();
要给newScore 赋值并注明它的类型
MInner mi=new MInner();
// 调用内部类的方法
int newScore=mi.getScore();
要给newScore 赋值并注明它的类型
2017-03-29
public class Initail {
public static void main(String[] args) {
Telphone phone1=new Telphone();
phone1.screen=5.5f;
Telphone phone2=new Telphone();
phone2.screen=5.5f;
if(phone1.equals(phone2)){
System.out.println("两个对象相同");
}
else{System.out.println("两个对象不同"); }}}
public static void main(String[] args) {
Telphone phone1=new Telphone();
phone1.screen=5.5f;
Telphone phone2=new Telphone();
phone2.screen=5.5f;
if(phone1.equals(phone2)){
System.out.println("两个对象相同");
}
else{System.out.println("两个对象不同"); }}}
2017-03-28
public class HelloWorld {
static int score1 = 86;
static int score2 = 92;
public static int sum() {
return(score1+score2);
}
public static void main(String[] args) {
// 调用静态方法sum并接收返回值
int allScore = sum();
System.out.println("总分:" + allScore);
}
}
static int score1 = 86;
static int score2 = 92;
public static int sum() {
return(score1+score2);
}
public static void main(String[] args) {
// 调用静态方法sum并接收返回值
int allScore = sum();
System.out.println("总分:" + allScore);
}
}
2017-03-28
同志们帮忙看看哪里错了
package china;
import uk.*;
public class Family{
public static void main(String[] args) {
Family ukFamily=new Family();
}
public Family(){
System.out.println("china包被使用");
}
}
package uk;
public class Family {
public Family(){
System.out.println("uk包被使用");
}
}
package china;
import uk.*;
public class Family{
public static void main(String[] args) {
Family ukFamily=new Family();
}
public Family(){
System.out.println("china包被使用");
}
}
package uk;
public class Family {
public Family(){
System.out.println("uk包被使用");
}
}
2017-03-28
1.通过 “类名.静态变量” 访问静态变量 如:HelloWorld.className
2.通过 “对象名.静态变量” 访问静态变量
HelloWorld demo=new HelloWorld();
Syso(demo.className);
2.通过 “对象名.静态变量” 访问静态变量
HelloWorld demo=new HelloWorld();
Syso(demo.className);
2017-03-27
1.通过 “类名.静态变量” 访问静态变量 如:HelloWorld.className
2.通过 “对象名.静态变量” 访问静态变量
2.通过 “对象名.静态变量” 访问静态变量
2017-03-27