Declaring Classes Abstract Methods and Classes Nested Classes Interfaces Enum Types Creating and Using Packages Using Package Members (import statements, static imports) Defining an Interface Implementing an Interface Abstract Methods and Classes Primitive Data Types Arrays Enum Types Understanding Instance and Class Members Variables Declaring Member Variables Understanding Instance and Class Members Passing Information to …
Category: Complete Courses
Jul 16
SCJP Training: Lesson 2: Flow Control #Java Short Notes #SCJP
The if-then and if-then-else Statements The switch statement The for Statement The while and do-while Statements Branching Statements Questions and Exercises:Classes (assertion example) Catching and Handling Exceptions The try Block The catch Blocks The finally Block Putting It All Together The Catch or Specify Requirement Specifying the Exceptions Thrown by a Method Putting It All …
Jul 16
SCJP: Rules #Java Short Notes #SCJP
A class’s superclasses don’t have to implement Serializable in order to be serialized if a superclass doesn’t implement Serializable then it’s constructor will run during deserialization A transient variable’s state is lost during serialization, but a volatile variable’s state is not lost Java:Volatile variable Transient Variable NumberFormat, Calendar, DateFormat are abstract classes. Use the getInstance …
Jul 16
SCJP: Short Notes #Java Short Notes #SCJP
For the package package com.sun2;public enum Seasons {SUMMER, FALL, WINTER, SPRING} Valid import statements are: import com.sun2.Seasons; // the class import static com.sun2.Seasons.*; //all enum valuesimport static com.sun2.Seasons.FALL; //only one enum value An interface can extend many interfaces Interfaces can have variables, overrides and overloads An enum can have methods and can override those methods …
Jul 16
SCJP: More Rules #Java Short Notes #SCJP
java -classpath gFolder/Game.jar civilization.java: In such command, -classpath will override (replace) CLASSPATH environment variable. java -classpath gFolder/Game.jar civilization.java: if both gFolder and current directory contain Game.jar then the jar file under gFolder will be used. If you want java compiler to recognize your jar file, either you have to mention the location of the jar …
Jul 16
SCJP Practice Exams #Java Short Notes #SCJP
Check these practice exams. Be careful that many java rules may have changed over the time. Check that which jdk version or the exam these practice exams support http://www.jchq.net/mockexams/exam2.htm 20 practice exams Java Ranch JavaRanch Self Tester Marcus Green’s Mock Exam 1 Marcus Green’s Mock Exam 2 Marcus Green’s Mock Exam 3 Sun’s SCJP2 Site …
Jul 16
SCJP: Basic Java I/O #Java Short Notes #SCJP
ByteStream is the basic I/O stream. Handles data as a stream of bytes. Does operation with byte unit and uses 8 bit. FileInputStream, FileOutputStream – can be used to copy files as byte by byte. Character Streams: FileReader and FileWriter are character streams. They treat file data as 16 bit unicode charater streams. InputStreamReader, OutputStreamWriter …
Jul 16
SCJP: Java Concurrency #Java Short Notes #SCJP
Java High Level Concurrency Objects constructors cannot be synchronized Liveness of multi-threaded applications Immutable Objects An application may have one or more processes. A process may have one or more threads. Two ways to create threads Thread.sleep(4000); To pause a thread. The time like 4000 ms is really dependent on the os and not precise …
Jul 16
SCJP: Class Declarations #Java Short Notes #SCJP
class declarations Start with modifiers such as public, private followed by class keyword The class name, with the initial letter capitalized The name of the class’s parent (superclass), preceded by the keyword extends (if any). A class can only extend (subclass) one parent. list of interfaces implemented by the class, preceded by the keyword implements …
Jul 16
SCJP: Interfaces #Java Short Notes #SCJP
Interface An interface is a reference type, similar to a class Interfaces can contain only constants, method signatures, and nested types No method is implemented Interfaces cannot be instantiated They can only be implemented by classes or extended by other interfaces Interfaces are not part of the class hierarchy A class can implement multiple interfaces …