I just made the first mock exam from the SCJP book. Some questions occurred, where I am a little bit unsure:
1) If I use , do I still access the Strings with agrs, agrs and so on?
2) Method: --> if z has the value 3, the method call returns 3, not 4, right?
3) --> the go method has "void" as return value, so that is not possible (because it does not return anything. But what else is not allowed? I do not understand this?
Does String s; or String s = "test"; return anything? Can someone please explain me this rule?
4) I thought that an interface declaration MUST be declared public? (I know that methods are declared public abstract implicitly, and constants are declared static final implicitly)
3) The second part of assert statement after : cannot have a call to a method returning void. See this 4) Interfaces are not required to be declared public
5) ArithmeticException is thrown when 10 is divided by 0 not NumberFormatException. NumberFormatException is generally thrown by parseXXX methods like parseInt to indicate that the parsed String cannot be parsed into a number.
6) I cannot understand this question of yours. You've written short = 3 which is not even a legal java syntax...
As for assert statement, you cannot put "anything" after : in assert statement. It should be an expression which returns a value. Check the documentation of AssertionError class, it has a number of constructors which take primitive types and Object as argument. So the part after : can be anything which returns a primitive or Object as a value...