1) The code will compile and run, printing out the words "My Func"
A class that contains an abstract method must be declared abstract itself, but may contain non abstract methods.
4) The code will compile but will complain at run time that main is not correctly defined
In this example the parameter is a string not a string array as needed for the correct main method
1) public
2) private
4) transient
The keyword transient is easy to forget as is not frequently used. Although a method may be considered to be friendly like in C++ it is not a Java keyword.
2) The compiler will complain that the Base class is not declared as abstract.
If a class contains abstract methods it must itself be declared as abstract
1) To get to access hardware that Java does not know about
3) To write optimised code for performance in a language such as C/C++
4) Success in compilation and output of "amethod" at run time.
A final method cannot be ovverriden in a sub class, but apart from that it does not cause any other restrictions.
4) Compilation and execution without error
It would cause a run time error if you had a call to amethod though.
|
您将承担一切因您的行为、言论而直接或间接导致的民事或刑事法律责任
留言板管理人员有权保留或删除其管辖留言中的任意内容 本站提醒:不要进行人身攻击。谢谢配合。 |