SCJP Certification Exam Review Note Series

zhaozj2021-02-12  178

Go to SCJP next week, review it again for two days.

The start () method of calling the thread instance His run () method is running, and you call Run () it will run. The method of the Java is transmitted by value, the simplest case is to pass the basic data type. He cannot change the parameters passed to him, for example, the following program will output 0Public class myclass {public static void main (string argv []) {myclass mc = new myclass (); int i = 0; mc.increment (i) System.out.Println (i);} void increment (int i) {i ;}} THROWS is used in the method's declaration that the method may have an exception, and the throw indicates an exception. Do not confuse the outstanding exception in Finally can cause the exception in TRY to be ignored. Looking down below public class test2 {public static void main (string [] args) throws exception {{f ();} finally {m ();}} public static void f () throws myException {throw new myException () ;} public static void m () throws MyException2 {throw new MyException2 ();}} class MyException extends Exception {} class MyException2 extends Exception {} assert Exp1: Exp2 this situation in Exp2 If the method then has to return the value to be It is the basic data type or any Object but cannot be Void. If you provide a class constructor, the compiler will not provide a parametric constructor to give you, often there will be problems when the class is extended. The following example cannot compile Class Base {base (int i) {System.Out.println ("Base");}} Class Derived Extends Base {public static void main (String argv []) {derived d = new deerid ();} void derived () {system.out.println "Derived");}} The method of Native cannot be covered by Natives, because they usually use C / C to implement public class myclass {private static int x = getValue (); private static int y = 5; private static int getValue () {return y;} public static void main (string args []) {system.out.println (x); system.out.println (y);}} The output of this program Yes 0,5.

转载请注明原文地址:https://www.9cbs.com/read-7658.html

New Post(0)