SCJP Training: Lesson 2: Flow Control #Java Short Notes #SCJP

From: http://sitestree.com/?p=5049
Categories:Java Short Notes, SCJP
Tags:
Post Data:2007-05-18 16:05:29

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

SCJP Training: Lesson 1: Develop code that declares classes (including abstract and all forms of nested classes), interfaces, and enums, and includes the appropriate use of package and import statements (including static imports). #Java Short Notes #SCJP

From: http://sitestree.com/?p=5047
Categories:Java Short Notes, SCJP
Tags:
Post Data:2012-06-10 07:14:48

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

SCJP Essential Knowledge #Java Short Notes #SCJP

    • int x=5; String y=”3″; System.out.print(x + 1 + y); Output: 63
    • When there is no live reference to an object, the object becomes eligible for garbage collection.
    • The concrete interface method implementation must be public.
    • When a class implements Comparator, it must implement a compare method.
    • When a class implements Comparable, it must implement a compareTo method.
    • The Arrays.asList() method creates a fixed-size list
    • A method like void go(Set a) can be called with objects created as: TreeSet t = new TreeSet(); TreeSet t = new TreeSet();. Remember, TreeSet t = new TreeSet(); TreeSet t = new TreeSet(); will not work where Dog is a sub-class of Animal.
    • When two enums are equal, both .equals and == always return true.
    • TreeSet is ordered in their natural order or according to the Comparator provided at creation.
    • SortedMaps are abstract
    • Is-a relationships can use inheritance
    • Tightly encapsulated classes can have a has-a relationship
    • is-a or has-a relationships does not apply to methods
    • java command in details:
      Usage: java [-options] class [args...]           (to execute a class)   or  java [-options] -jar jarfile [args...]           (to execute a jar file)where options include:    -client	  to select the "client" VM    -server	  to select the "server" VM    -hotspot	  is a synonym for the "client" VM  [deprecated]                  The default VM is client.                      -cp     -classpath                   A ; separated list of directories, JAR archives,                  and ZIP archives to search for class files.    -D=                  set a system property    -verbose[:class|gc|jni]                  enable verbose output    -version      print product version and exit    -version:                  require the specified version to run    -showversion  print product version and continue    -jre-restrict-search | -jre-no-restrict-search                  include/exclude user private JREs in the version search    -? -help      print this help message    -X            print help on non-standard options    -ea[:...|:]    -enableassertions[:...|:]                  enable assertions    -da[:...|:]    -disableassertions[:...|:]                  disable assertions    -esa | -enablesystemassertions                  enable system assertions    -dsa | -disablesystemassertions                  disable system assertions    -agentlib:[=]                  load native agent library , e.g. -agentlib:hprof                    see also, -agentlib:jdwp=help and -agentlib:hprof=help    -agentpath:[=]                  load native agent library by full pathname    -javaagent:[=]                  load Java programming language agent, see java.lang.instrument

From: http://sitestree.com/?p=4893
Categories:Java Short Notes, SCJP
Tags:
Post Data:2008-03-02 15:26:47

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

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

From: http://sitestree.com/?p=4892
Categories:Java Short Notes, SCJP
Tags:
Post Data:2007-11-16 02:44:22

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

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 file in javac command using -classpath switch or you have to add the jar file in the CLASSPATH environment variable. Mentionable – you need to add the file, adding upto the directory will not work.
  • Garbage collection: can Java program run out of memory? yes.
  • Can objects be garbage collected even if it has a valid reference? yes. when no live thread has access to the object.
  • Can Objects created within inner classes be eligible for garbage collection.? yes.
  • Do garbage collector deletes objects from the stack? No. As objects reside in heaps not in the stack.
  • If an object’s finalize method runs to completion will it always be garbage collected? No. The finalize method may create some other references.
  • Arrays.equals(Object[] a1, Object[] a2) : Returns true if the two specified arrays of Objects are equal to one another
  • The results of Binary search on an unsorted array are undefined
  • Alpha go(int i) is a valid method declaration with a generic return type. class Alpha{}

From: http://sitestree.com/?p=4891
Categories:Java Short Notes, SCJP
Tags:
Post Data:2010-06-26 02:46:16

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

SCJP: Short Notes #Java Short Notes #SCJP

From: http://sitestree.com/?p=4888
Categories:Java Short Notes, SCJP
Tags:
Post Data:2011-10-20 04:13:02

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

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 method to get NumberFormat instances.
  • The + quantifier in a regular expression indicates 1 or more occurrences, * indicates 0 or more, [] just one character in the group, () indicates a whole group match.
  • The default separator in Scanner class is a blank NOT a comma
  • Multiple threads can be created using the same Runnable object, but a given thread can be started only once.
  • Thread.yield(): Causes the currently executing thread object to temporarily pause and allow other threads to execute.
  • Thread.join(): Waits for this thread to die.
  • Wait(), Notify(), NotifyAll() methods
  • Low coupling: classes know the least possible about each other, is preferable over tight coupling.
  • High cohesion: Each class has well focused responsibilities. Is preferable over low cohesion.
  • Polymorphism does NOT apply to static methods.
  • Instance variable cannot be referenced from static method

From: http://sitestree.com/?p=4883
Categories:Java Short Notes, SCJP
Tags:
Post Data:2011-09-04 06:32:26

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

SCJP: Java Concurrency #Java Short Notes #SCJP

From: http://sitestree.com/?p=4879
Categories:Java Short Notes, SCJP
Tags:
Post Data:2009-04-19 03:15:05

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

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 are also character streams. May be used in socket data reading.
  • Line-Oriented I/O: BufferedReader and PrintWriter
  • Buffered Streams: BufferedInputStream and BufferedOutputStream create buffered byte streams, while BufferedReader and BufferedWriter create buffered character streams
  • You can set autoflush() of buffered streams or call manually flush() method.
  • The scanner API breaks input into individual tokens. The formatting API assembles data into nicely formatted, human-readable form.
  • Scanner:
    Scanner scanner = new Scanner(new BufferedReader(new FileReader("test.txt")));            while (s.hasNext()) {                System.out.println(s.next());            }
  • To create formatted output streams, instantiate PrintWriter not PrintStream
  • Check: System.out.format(“The square root of %d is %f.%n”, i, r);
  • System.out and System.err are PrintStream objects. PrintStream is really a byte stream but uses some mechanism to emulate character stream.
  • InputStreamReader cin = new InputStreamReader(System.in); System.in is a byte stream. InputStreamReader is used to emulate a character stream.
  • System.console provides character streams to handle console read/write operations. Provides readPassword method to read password from the console
  • Data Streams: Support I/O operations of primitive data types. DataInputStream and DataOutputStream.
  • Check:
    out = new DataOutputStream(new            BufferedOutputStream(new FileOutputStream(dataFile)));out.writeDouble(prices);out.writeInt(units);out.writeUTF(descs);
  • DataStreams detects an end-of-file condition by catching EOFException
  • Correct type to represent currency values: java.math.BigDecimal – an object type
  • Object Streams: ObjectInputStream and ObjectOutputStream. Use writeObject and readObject to write and read objects respectively.
  • A stream can contain only one copy of an object but many references to it when required.
  • File Objects: File I/O
  • Random access file:
    new RandomAccessFile("test.txt", "r");new RandomAccessFile("test.txt", "rw");RandomAccessFile methods:    * int skipBytes(int)     * void seek(long)      * long getFilePointer() 
  • The new java.nio.* package provides supports to handle file i/o for high performance applications.

From: http://sitestree.com/?p=4878
Categories:Java Short Notes, SCJP
Tags:
Post Data:2012-10-24 02:25:07

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Java : SCJP: Important Resources #Java Short Notes #SCJP

From: http://sitestree.com/?p=4876
Categories:Java Short Notes, SCJP
Tags:
Post Data:2008-03-19 18:31:53

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada