我从讲座中得到了以下问题,并告诉他答案是iii.It compiles, runs and prints the string “Hello”
但我相信答案是i. It has a compilation error
这是因为B级进口packA的方式是不正确,而应该是导入packA.A或packA。*
我的问题是 - 这是一个错字还是可以运行并打印“你好”
J. Assuming the class A and class B given below are defined in different packages, packA and packB.
package packA;
public class A {
protected void msg() {
System.out.println("Hello");
}
}
package packB;
import packA;
class B extends A {
public static void main(String[] args) {
B obj = new B();
obj.msg();
}
}
which of the following is correct about the class B?
i. It has a compilation error
ii. It has a run time error
iii.It compiles, runs and prints the string “Hello”
iv. None of the above
答案 0 :(得分:0)
导入确实存在错误。它应该是Vector <- c("alex" ,"IT")
Tst <- data.frame( name.charcher(), major.charachter())
sqldf( c(" insert into Tst values (" , Vector[1] , "," ,Vector[2] , ")" , "select * from main.Tst "))
。