⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tips.html

📁 java scjp考试必备.scjp模块考试最优秀经典之作,运行里只需要java环境支持,使用方便简单.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
        provided by these operators is the right operand is not evaluated if the 
        result of the operation can be determined after evaluating only the left 
        operand.</li>
      <li>Understand the difference between x = ++y; and x = y++; In the first 
        case y will be incremented first and then assigned to x. In the second 
        case first y will be assigned to x then it will be incremented. </li>
      <li>Please make sure you know the difference between &lt;&lt; , &gt;&gt; 
        and &gt;&gt;&gt;(unsigned rightshift) operators. </li>
    </ol>
  </li>
  <br>
  <li><b>Overloading, Overriding, Runtime Type and Object Orientation</b> 
    <ol>
      <li value=77>A static method cannot be overridden to non-static and vice 
        versa.</li>
      <li>A final class cannot be subclassed.</li>
      <li>A final method cannot be overridden but a non final method can be overridden 
        to final method.</li>
      <li>All the static variables are initialized when the class is loaded.</li>
      <li>An interface can extend more than one interface, while a class can extend 
        only one class.</li>
      <li>Instance variables of a class are automatically initialized, but local 
        variables of a function need to be initialized explicitly. </li>
      <li>An abstract method cannot be static because the static methods cannot 
        be overridden.</li>
      <li>An abstract class may not have even a single abstract method but if 
        a class has an abstract method it has to be declared as abstract.</li>
      <li>A method cannot be overridden to be more private. E.g. a public method 
        can only be overridden to be public. </li>
      <li>While casting one class to another subclass to superclass is allowed 
        without any type casting. e.g. A extends B, B b = new A(); is valid but 
        not the reverse.</li>
      <li>Abstract classes cannot be instantiated and should be subclassed.</li>
      <li>Abstract classes can have constructors, and it can be called by super() 
        when its subclassed. </li>
      <li>Both primitives and object references can be cast.<br>
      </li>
      <li>Polymorphism is the ability of a superclass reference to denote objects 
        of its own class and its subclasses at runtime. This is also known as 
        Dynamic Method Lookup.<br>
      </li>
      <li> According to Method Overloading Resolution, most specific or matching 
        method is chosen among the available alternative methods that do not directly 
        match the argument lists but matches after automatic casting. Ambiguity 
        is shown when compiler cannot determine which one to choose between two 
        overloaded methods.<br>
      </li>
      <li> Constructors are not inherited so it is not possible to override them.<br>
      </li>
      <li>A constructor body can include a return statement provided no value 
        is returned. <br>
      </li>
      <li>A constructor never returns a value. If you specify a return value, 
        the JVM (Java virtual machine) will interpret it as a method. <br>
      </li>
      <li>If a class contains no constructor declarations, then a default constructor 
        that takes no arguments is supplied. This default constructor invokes 
        the no-argument constructor of the super class via super() call (if there 
        is any super class, except java.lang.Object).<br>
      </li>
      <li>If inner class is declared in a method then it can access only final 
        variables of the particular method but can access all variables of the 
        enclosing class. <br>
      </li>
      <li>To refer to a field or method in the outer class instance from within 
        the inner class, use Outer.this.fieldname.<br>
      </li>
      <li>Inner classes may not declare static initializers or static members 
        unless they are compile time constants i.e. static final var = value; 
        <br>
      </li>
      <li> A nested class cannot have the same name as any of its enclosing classes. 
        <br>
      </li>
      <li>Inner class may be private, protected, final, abstract or static. <br>
      </li>
      <li>An example of creation of instance of an inner class from some other 
        class:<br>
        class Outer<br>
        {<br>
        public class Inner{}<br>
        }<br>
        class Another<br>
        {<br>
        public void amethod()<br>
        {<br>
        Outer.Inner i = new Outer().new Inner();<br>
        }<br>
        }<br>
      </li>
      <li> Classes defined in methods can be anonymous, in which case they must 
        be instantiated at the same point they are defined. These classes cannot 
        have explicit constructor and may implement interface or extend other 
        classes.<br>
      </li>
      <li>One class in Java cannot reside under two packages. If no package declaration 
        is made, a class is assumed to be the member of default or unnamed package.</li>
    </ol>
  </li>
  <br>
  <li><b> Threads</b> 
    <ol>
      <li VALUE=104> The Thread class resides in java.lang package and so need 
        not be imported.</li>
      <li> A Java thread scheduler can be preemptive or time-sliced, depending 
        on the design of the JVM.<br>
      </li>
      <li> The sleep and yield methods of Thread class are static methods. <br>
      </li>
      <li>The range of Thread priority in Java is 1-10. The minimum priority is 
        1 and the maximum is 10. The default priority &nbsp;of &nbsp;&nbsp;any 
        thread in Java is 5. <br>
      </li>
      <li> There are two ways to provide the behavior of a thread in Java: extending 
        the Thread class or implementing the &nbsp;&nbsp;Runnable interface. <br>
      </li>
      <li>The only method of Runnable interface is &quot;public void run();&quot;. 
        <br>
      </li>
      <li> New thread takes on the priority of the thread that spawned it. <br>
      </li>
      <li>Using the synchronized keyword in the method declaration, requires a 
        thread obtain the lock for this object before it &nbsp;&nbsp;can execute 
        the method. <br>
      </li>
      <li> A synchronized method can be overridden to be not synchronized and 
        vice versa. <br>
      </li>
      <li>In Java terminology, a monitor (or semaphore) is any object that has 
        some synchronized code.<br>
      </li>
      <li>Both wait() and notify() methods must be called in synchronized code. 
        <br>
      </li>
      <li>The notify() method moves one thread, that is waiting on this object's 
        monitor, into the Ready state. This could be any &nbsp;&nbsp;of the waiting 
        threads. <br>
      </li>
      <li> The notifyAll() method moves all threads, waiting on this object's 
        monitor into the Ready state. <br>
      </li>
      <li>Every object has a lock and at any moment, that lock is controlled by 
        at most one single thread.<br>
      </li>
      <li> There are two ways to mark code as synchronized:<br>
        a.) Synchronize an entire method by putting the synchronized modifier 
        in the method's declaration.<br>
        b.) Synchronize a subset of a method by surrounding the desired lines 
        of code with curly brackets ({}).<br>
      </li>
      <li> Deadlock a special situation that might prevent a thread from executing. 
        In general terms, if a thread blocks because it &nbsp;&nbsp;is waiting 
        for a condition to arise and something else in the program makes it impossible 
        for that condition to arise, then &nbsp;&nbsp;the thread is said to be 
        deadlocked.</li>
    </ol>
  </li>
  <br>
  <li><b>java.lang Package</b></li>
  <ol>
    <li VALUE=120> java.lang package is automatically imported in every java source 
      file regardless of explicite import statement.<br>
    </li>
    <li> The String class is a final class, it cannot be subclassed.<br>
    </li>
    <li>The Math class has a private constructor, it cannot be instantiated.<br>
    </li>
    <li> The random() method of Math class in Java returns a random number, a 
      double, greater than or equal to 0.0 and less &nbsp;&nbsp;than 1.0.<br>
    </li>
    <li> The String class in Java is immutable. Once an instance is created, the 
      string it contains cannot be changed. e.g. String &nbsp;&nbsp;s1 = new String(&quot;test&quot;); 
      s1.concat(&quot;test1&quot;); Even after calling concat() method on s1, 
      the value of s1 will remain to be &nbsp;&nbsp;&quot;test&quot;. What actually 
      happens is a new instance is created. But the StringBuffer class is mutable.<br>
    </li>
    <li> The + and += operators are the only cases of operator overloading in 
      Java and is applicable to Strings.<br>
    </li>
    <li>The various methods of java.lang.Object are<br>
      &nbsp;&nbsp;clone, equals, finalize, getClass, hashCode, notify, notifyAll, 
      toString and wait.</li>
    <li> The Java.lang.System is a final class and cannot be subclassed. </li>
    <li> A String in Java is initialized to null, not empty string and an empty 
      string is not same as a null string. <br>
    </li>
    <li> The equals() method in String class compares the values of two Strings 
      while == compares the memory address of the &nbsp;&nbsp;objects being compared.<br>
      &nbsp;&nbsp;e.g. String s = new String(&quot;test&quot;); String s1 = new 
      String(&quot;test&quot;);<br>
      &nbsp;&nbsp;s.equals(s1) will return true while s==s1 will return false. 
      <br>
    </li>
    <li> The valueOf() method converts data from its internal format into a human-readable 
      form. It is a static method that is &nbsp;&nbsp;overloaded within String 
      class for all of Java's built-in types, so that each type can be converted 
      properly into a string.<br>
    </li>
    <li> All the wrapper class objects are immutable. Wrapper classes are final 
      also.<br>
    </li>
    <li> java.lang.Character has only a single constructor that takes a char (character) 
      as an argument.<br>
    </li>
    <li> hashCode() produces a hash code of type int for an object that is typically 
      used as an offset from the start of the &nbsp;&nbsp;memory that has been 
      allocated to that object</li>
  </ol>
<br><li><b> java.util Package</b></li>
  <ol>
    <li VALUE=134> Collections in Java (sometimes known as bag or multiset) can 
      only hold object references not primitive values. But &nbsp;arrays in Java 
      can hold both primitive values and object references.<br>
    </li>
    <li> Collection is an Interface whereas Collections is a helper class.<br>
    </li>
    <li>Collection imposes no order nor restrictions on content duplication.<br>
    </li>
    <li>The main difference between Vector and ArrayList is that Vector is synchronized 
      while the ArrayList is not. <br>
    </li>
    <li> A Set is a collection, which cannot contain any duplicate elements and 
      has no explicit order to its elements. <br>
    </li>
    <li>A List is a collection, which can contain duplicate elements, and the 
      elements are ordered.<br>
    </li>
    <li>Maps use unique keys to facilitate lookup of their contents through key/value 
      pairs.<br>
    </li>
    <li>Set and List extend java.util.Collection interface, but Map has no super 
      interface. So Map does not implement the &nbsp;Collection interface though 
      it is a part of the Java's collection framework.<br>
    </li>
    <li> A Hashtable object is thread-safe (like Vector and unlike HashMap) and 
      do not accept null as a key.<br>
    </li>
    <li> TreeSet class implements SortedSet interface (sub interface of Set) that 
      holds its elements sorted in an order. In the same way, TreeMap class implements 
      SortedMap interface (sub interface of Map) that keeps its elements sorted 
      in an order.<br>
    </li>
  </ol>
</ol>
</body>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -