SCJP Certified my titbits.

Source: Internet
Author: User
Tags abstract exception handling final garbage collection inheritance variables variable thread

<<effective java>> and Design pattern java.io java.util

1.JAVA2 Certification Tutorial 2.Complete JAVA2 Certificate

public class Pegadapter extends squarepeg{

Private Roundpeg roundpeg;

Public Pegadapter (Roundpeg peg) (this.roundpeg=peg;)

public void Insert (String str) {roundpeg.insertintohole (str);}

}

In the code above, Roundpeg belongs to the Adaptee and is the fittest. The Pegadapter is adapter, which matches the adaptee (the roundpeg of the fittest) and target (destination squarepeg). Real

On the other, the combination method (composition) and the Inheritance (inheritance) method are used synthetically.

Pegadapter first inherits the Squarepeg and then uses the combination of new to generate objects, generate Roundpeg object Roundpeg, and then overload the parent class insert () method. From here, you too.

Instead of modifying the original class and not even having to know its internal structure and source code, the solution uses new to build objects and use extends to inherit the generated objects.

Java Group 8071103

Six, the examination point 1, earnest study review textbook.   2, more to do the topic (Jxam, PGJC, Marcus Green three sets of questions).   3, 61% Pass, suggest to the Sun's Web page before the test to do the first sun-given sample. Sun Sample URL: Https://tmn.sun.com/WLC/servlet/GuestLoginServlet?id=programmer 4, to pay attention to thread, more weight. Add a little to the constructor of every low-level stream, high-level stream, reader and writer of java.io.*, similar to listener,   Collection and so on, it is best to compare the JDK inside the instructions, the difficulty will be like that PGJC in the difficulty. 6, the exam encountered in the fill in the blanks, is generally string and stringbuffer output results, but the title is not 7, SCJP test the most basic knowledge, such as Java language features, event model, AWT, IO, Thread, net and so on.   In the SCJP exam only awt,swing in SCJD test. 8, review not too biased, the basic concept to get clear.   In addition, Io's constructor, Thread, Inner class, AnonyMouse class, override, overload topics are more important to review. 9, the impression of almost all the questions involved in more than 2-3 points of knowledge, almost no one can see the answer to the topic. The 70% exam is to give you a program, and then ask the value of the run result variable. This kind of topic is very easy to fall into the trap, carelessly is abolished. Another 20% of the topics are to give you a few statements, choose the right. These statements are very biased in the examination of things, it is not very good answer. Basically my experience is: if a topic can immediately see the answer, please study the topic carefully, most of the situation is that you fall into the trap. If a topic you can clearly see that he is going to test your knowledge point, then the topic is half done. The most miserable is to know the subject to test you what, but forgot or did not review the relevant knowledge 10, the examination of a focus is inner CLASS. More than half of the subjects in the impression were related to him. are big class sets of small class and so on. Be sure to thoroughly understand the relevant definitions, grammar, and especially the use of various modifier. There are a lot of very special modifer rules.   These rules must be mastered and kept in mind. 11, another focus of the examination is the circular statement. Test some very special use, although it can be done slowly, but waste too much time on this,It's really a pity.   Let's take a good look at the books. 12, Http://www.javaranch.com/maha, the above mock test and resource list is very good. Be sure to look at its mock list.

Declaration and permission control, flow control and exception handling, garbage collection mechanism, basic syntax, operands and symbols, overloading, overwriting, running type and object-oriented, threading, etc. and there's JAV.

Common classes in A.awt, Java.lang, Java.util, java.io packages

5.math,interger,boolean ... All types of packing classes are final and not inheritable.

Set: 1. The relationship between the interface and class, only the last one is class Collection:list:vector,arraylist,linkedlistmap:sortedmap:treemapcollection:set:sortedset : TreeSetMap:HashTableCollection:Set:HashSet

7.XOR the same as 0, not the same as 1 1,1=0;0,0=0;1,0/0,1=18. x = = Float.nan compilation error, should be Float.isnan 9. x = = Double.positive_infinity compilation can 10.-1 be 1111 .... 1111,<< forever Right complement 0,>> positive complement 0, negative complement one,>>> constant complement zero 10.1-1>> how many bits are-1; 1<<31 into the smallest negative number, 1000....000011. The maximum positive number is 01111 .... 111112. The minimum negative number is 1000 .... 0000 (-2147483648) 6. 1>>1 is 07. %= <<= =>> =>>> are all legal symbols.

6. Static methods will change as the class changes, see example: Class Parent{static void Test () {System.out.println ("hi,parent")}; Class Child extends parent{static void Test () {System.out.println ("Hi,child")} Parent p = new Child ();p. Test (); file://, it's hi,parent!.

8.transient can only be used on member variables of classes, not in methods. 9.transient variables cannot be final and static 10.native methods can be PRIVATE,ABSTRACTD

Final I=1; byte b=i; just ok!. I don't know why, but final is OK. And, according to my experiment, only the relationship between int and Byte is so, others not. 5.int i[]; Object[] obj=i; wrong! Object obj=i; Yes! Arrays can only be converted to object, not object[]6.int i[]; Object[] obj;i= (int[]) obj; Right! objects can be explicitly turned into an array.

Protected can only be used to modify member variables and methods, which are equivalent to public in the same package and can only be used outside the package in the subclass's class body (only in the case of inheritance | The parent class member or method cannot be accessed with the parent class instance handle in the class body of the subclass, but the subclass instance handle can be invoked in the class body of the child class.

A protected parent class member or method (also available in the static Main method) is not available outside the subclass class body. In the subclass's class body, you can certainly also use this, super to access the parent class

A member or method of protection. < instance handles do not include this, super>). The Finalfinal class cannot be inherited, the final method cannot be overridden but can be inherited, and a non static final attribute can only be assigned a value, and the initial values must be given when the object is initialized, so

An initial value can only be given when declared, in a statement block or in a constructor. A static final variable can only give an initial value in a declaration or in a static statement block. Final local variables can be declared without giving an initial value, but only once in the life cycle. Final can also be used to modify method parameters. Abstract classes cannot have instances, abstractions cannot have method bodies, and abstract methods must be implemented in subclasses or continue to be declared abstract. An abstract method can only exist in an abstract class,

Methods in an abstract class are not necessarily abstract. A class implements an interface that must be abstract if none of the methods in the interface are implemented. Abstract methods cannot be private, others are possible. Abstract classes can inherit non-abstract classes and use abstract methods to override non abstract methods in the parent class. Staticstatic can be used to modify variables, methods, and statement blocks. It is a good practice to refer to a static member variable with a class name instead of an instance handle. Static variables can also be referenced with object handles,

You do not have to have an object, but this handle is initialized (no initialization will report a compilation error), and you can assign a value to NULL for the handle. Nativenative can only be used to modify methods, the method body of the native method is not in the JVM, and in a library, the code for the native method is not written in Java and has a clear target machine.

Generally, before using the native method to load the library with a static statement block, the code is as follows: Class nativeexample {native void dosomethinglocal (int i);//native method static {System. LoadLibrary ("Mynativelab");} Loading a library with a static statement block}STRICTFP can be used to modify methods and classes, while modifying methods means that the access to floating-point numbers in the method follows the IEEE754 standard, and when the class is decorated it means that all methods in this class comply with the access to the floating-point number

Follow the IEEE754 standard. Transienttansient can only be used to decorate member variables, and the member variables decorated with this keyword do not participate in serialization when the object is serialized. Volatile this modifier can only be used to decorate a member variable (static and not static can be). NOTE: 1 The statement block can be static or not static, but cannot be decorated with final, static statement blocks are executed only once when the class is loaded, rather than the static statement blocks each time they are generated

The instance of the class is executed once.



Initialization order of Java programs 1. The first thing to initialize is static (the property [final/Fianal], the statement block), in the Order of the code in static. 2. The parent class constructor is then invoked to construct the parent class object 3. Then initialize something that is not static (the attribute [final/], the statement block), in the Order of the code in the non static. 4. Finally executes the constructor code of its own class. Note: The four access control symbols do not affect the initialization order, as ordered in the code.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.