[b].若String str =”abc”; int a =123;则str +123的值是 。
4描述一个对象主要从 和 两个方面描述。
5. Java源程序文件的扩展名为 。
6. Java提供的访问权限修饰符有4个,即: 、 private和默认。
class AB{
private String s1,str2;
public AB(String str1,String str2){s1 = str1; s2 = str2}
public String toString( ){return s1 +s2;}}
public class Test{
public static void main(String []args){
AB ab = new AB(“Hello!”,”I love Java”);
System.out.println(ab.toString());
}}
public class Animal {
public void eat(){System.out.println("eat something");}
}
public class Cattle extends Animal {
public void eat(){System.out.println("喜欢吃草");}
}
public class AnimalTest {
public static void main(String []args){
Animal animal = new Animal( ); animal.eat();
Animal cow = new Cattle( ); cow.eat(); }}
public class Test{
public static void main(String [] args){
int i=1,sum =0;
for(i =1;i