Category Archives: SCJP/OCJP

SCJP Certification Topics – Short Notes

SCJP Training: Lesson 3: API Contents #Java Short Notes #SCJP

From: http://sitestree.com/?p=5050
Categories:Java Short Notes, SCJP
Tags:
Post Data:2011-03-16 12:43:36

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 4: Concurrency #Java Short Notes #SCJP

From: http://sitestree.com/?p=5051
Categories:Java Short Notes, SCJP
Tags:
Post Data:2006-11-03 06:59:23

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 5: OO Concepts #Java Short Notes #SCJP

From: http://sitestree.com/?p=5052
Categories:Java Short Notes, SCJP
Tags:
Post Data:2009-12-15 16:31:08

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 6: Collections / Generics #Java Short Notes #SCJP

From: http://sitestree.com/?p=5053
Categories:Java Short Notes, SCJP
Tags:
Post Data:2012-07-21 07:53:36

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 7: Fundamentals #Java Short Notes #SCJP

From: http://sitestree.com/?p=5054
Categories:Java Short Notes, SCJP
Tags:
Post Data:2009-05-18 14:59:18

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 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 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: 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: 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: 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 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: 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

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: 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 (if any). A class can implement more than one interface
  • The class body, surrounded by braces, {}.
  • Class member variable declarations
    • Requires three components, in order:
    • Zero or more modifiers, such as public or private
    • The field's type
    • The field's name.

Abstract Classes

  • A class declared with abstract keyword is an abstract class. It may or may not include abstract methods
  • Abstract classes cannot be instantiated
  • Abstract classes can be subclassed
  • Class containing abstract methods, must be declared to be abstract
  • Abstract methods are methods declared without implementation (braces)
  • The subclass of an abstract class must provide implementations of all the abstract methods otherwise the subclass itself needs to be declared as abstract.
  • An abstract class may have static and final fields and methods. Interfaces can not
  • If an abstract class contains only abstract method declarations with no implementations, it should better be declared as an interface
  • It's a good design to declare a common abstract class with common methods with implementations for several very related classes (will extend the abstract class)
  • An abstract class can implement an interface but are not bound to implement all interface methods

Nested Classes

  • Classes declared under another class are called nested classes
  • Two types: Static Nested: declared with static keyword, Inner Nested: declared with no static keyword
  • inner classes have access to other members of the outer class including private members
  • Static nested classes do not have access to other members of the outer class
  • Static nested classes are accessed using the outer class name such as: OuterClass.StaticNestedClass
  • To use inner classes, the outer class must be instantiated first. Then, inner object can be created as follows: OuterClass.InnerClass innerObject = outerObject.new InnerClass();
  • Local inner classes: Declared within the body of a method
  • Anonymous inner classes: Declared within the body of a method without naming it
  • Inner classes may have similar access modifiers like other outer class members
  • Why use nested classes:
    • For logically grouping classes that are only used in one place
    • It increases encapsulation.
    • May lead to more readable and maintainable code

From: http://sitestree.com/?p=4866
Categories:Java Short Notes, SCJP
Tags:
Post Data:2012-09-13 21:25:27

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: 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

From: http://sitestree.com/?p=4867
Categories:Java Short Notes, SCJP
Tags:
Post Data:2010-01-20 15:33:28

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: Random Stuffs #Java Short Notes #SCJP

  • An enum may NOT be declared in a method
  • An enum can be imported
  • If the JVM has a choice, it will select a method without varargs before selecting a method with varargs
  • When enums are equal, both .equals and == always return true
  • The headMap() method returns the portion of the map whose keys are less than the key sent to it
  • The asList() method of Arrays creates a fixed-size list that is backed by the array, so no additions are possible.
  • A static initialization block is a normal block of code enclosed in braces, { }, and preceded by the static keyword. Used to initialize class variables
  • All enums implicitly extend java.lang.Enum.
  • A class can extend only one other class, an interface can extend any number of interfaces
  • An interface might also contain constant definitions.
  • An abstract class that implements an interface may not implement all interface methods

From: http://sitestree.com/?p=4872
Categories:Java Short Notes, SCJP
Tags:
Post Data:2012-12-07 07:48:57

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

SCJP: Flow controls and exception #Java Short Notes #SCJP

Flow Control and ExceptionsFlow control statements

  • Conditional: if, if-else and switch-case
  • Looping: for, while, do-while
  • Exception handling: try-catch-finally, throw
  • Ad hoc flow control: break, continue with or without labels

switch statement

switch(expression){
case ConstantExpression: statement(s);
case ConstantExpression: statement(s);
.
.
.
default: statement(s);
}

  • expression: must be char, byte, short, or int, or a compile-time error occurs
  • long primitive can be used if type casted to int
  • Object reference cannot be used as expression
  • Every case expression must be unique
  • break statement may be used at the end of a case statement, to discontinue execution.
  • There can be at most only one default statement.
  • The order of case statements and default can be anything.

break and continue

  • A break statement transfers the control out of an enclosing statement. break used within a loop breaks the execution of the current loop. In case of nested loops, the break statement passes the control to the immediate outer loop.
  • A continue statement breaks the current iteration and moves to next iteration.
  • break and continue with labels.
    • Labels specify the target (statement) for continue and break
    • continue with label does not jump to the labeled statement but instead jumps to the end of the labeled loop.
    • Same label identifiers can be reused multiple times as long as they are not nested.
    • Label names do not conflict with the same named identifier(variable, method or class name).

Checked and Unchecked Exceptions

Checked Exceptions

  • Checked Exceptions are checked by the compiler to see if these exceptions are properly caught or specified. If not, the code will fail to compile
  • Checked exception forces client program to deal with the scenario in which an exception may be thrown
  • Checked exceptions must be either declared or caught at compile time

Unchecked Exceptions

  • Unchecked exceptions are RuntimeException and all of its subclasses.
  • Class java.lang.Error and its subclasses also are unchecked.
  • Unchecked Exceptions are not checked by the compiler.
  • Runtime exceptions do not need to be caught or declared.

From: http://sitestree.com/?p=4864
Categories:Java Short Notes, SCJP
Tags:
Post Data:2008-08-25 00:56:33

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: Classpath and Jar #Java Short Notes #SCJP #Blog

Java certification exams like SCJP test your knowledge about java classpath. Check here for an excellent resource on the topic .

System classpath

We can specify classpath in the command line or make use of a `system' class path. The IDEs have their own way of maintaining class paths. System class paths will be used by both the Java compiler and the JVM in the absence of specific instructions.

Set Linux System Classpath:
CLASSPATH=/myclasses/myclasses.jar;export CLASSPATH

Windows:
set CLASSPATH=c:myclassesmyclasses.jar

For permanent result, in Linux, put the commands in the file .bashrc in your home directory. On Windows 2000/NT, set it from `Control Panel', System, Environment Variables.

You can also specify .jar files full of your required classes in your classpath.

CLASSPATH=/usr/j2ee/j2ee.jar:.;export CLASSPATH

where the `.' indicates `current directory'.

From command line, if you want to add more paths to the classpath use:

Linux:javac -classpath $CLASSPATH:dir1:dir2 ...

Windows:javac -classpath %CLASSPATH%;dir1:dir2 ...

if you have spaces in your path use double quote to concatenate words.

Also check this resource

From: http://sitestree.com/?p=4849
Categories:Java Short Notes, SCJP, Blog
Tags:
Post Data:2013-06-05 14:27:56

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 Operators #Java Short Notes #SCJP

Exams like SCJP test your understanding of Java operators and how to use them like:
assignment operators: =, +=, -=
arithmetic operators: +, -, *, /, %, ++, --
relational operators: < , , >=, ==, !=
logical operators: &, |, ^, !, &&, ||
conditional operators: ? :
Also operators to check the equality of two objects or two primitives

In the following table operators and their precedences are shown. Upper rows operators have higher precedence. Same row operators have equal precedence. For equal precedence operators, All binary operators except the assignment operators work from left to right while assignment operators work from right to left.

Operator Precedence
Operators Precedence
postfix expr++ expr--
unary ++expr --expr +expr -expr ~ !
multiplicative * / %
additive + -
shift < > >>>
relational = instanceof
equality == !=
bitwise AND &
bitwise exclusive OR ^
bitwise inclusive OR |
logical AND &&
logical OR ||
ternary ? :
assignment = += -= *= /= %= &= ^= |= < >= >>>=

The following quick reference summarizes the operators supported by the Java programming language.

Simple Assignment Operator

=	Simple assignment operator

Arithmetic Operators

+ 	Additive operator (also used for String concatenation)- 	Subtraction operator*	Multiplication operator/ 	Division operator%	Remainder operator

Unary Operators

+ 	Unary plus operator; indicates positive value (numbers are positive without this, however)- 	Unary minus operator; negates an expression++  	Increment operator; increments a value by 1--    	Decrement operator; decrements a value by 1!     	Logical compliment operator; inverts the value of a boolean

Equality and Relational Operators

==	Equal to!=	Not equal to>	Greater than>=	Greater than or equal to< Less than<=	Less than or equal to

Conditional Operators

&& 	Conditional-AND|| 	Conditional-OR?:      Ternary (shorthand for if-then-else statement)

Type Comparison Operator

instanceof	Compares an object to a specified type 

Bitwise and Bit Shift Operators

~	Unary bitwise complement< >	Signed right shift>>>	Unsigned right shift&	Bitwise AND^	Bitwise exclusive OR|	Bitwise inclusive OR

Details about java operators

From: http://sitestree.com/?p=4848
Categories:Java Short Notes, SCJP
Tags:
Post Data:2012-12-29 02:01:30

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: Language Fundamentals #Java Short Notes #SCJP

Class declaration and java source file.

  • Only "one" top-level public class is allowed per java source file.
  • The name of the java source file and the name of the top-level public class MUST be the same.
  • If no public class is there in a file, after compiling separate class files will be created for all classes in the file.
  • Package statement, import statements and class definition MUST appear in the order given.

Keywords and Identifiers

  • Keywords are always in a lower case.
  • Some keywords: const, goto, strictfp, and volatile
  • Identifiers must start with either letter, $ or _ (underscore) and can have letter, $, _ or digits in it.
  • no keyword is allowed as identifiers
abstract do import public transient
boolean double instanceof return try
break else int short void
byte extends interface static volatile
case final long super while
catch finally native switch
char float new synchronized
class for package this
continue if private throw
default implements protected throws

Default Values, Local Variables

  • Each primitive data type has a default value specified. Variable of primitive data type may be initialized
  • Only class member variables are automatically initialized. Method variables need explicit initialization
  • Local variables (also known as automatic variables) are declared in methods and in code blocks
  • Automatic variables are not automatically initialized
  • local variables should be explicitly initialized before first use. These are automatically destroyed when they go out of scope

Arrays

  • Fixed-sized ordered collection of homogeneous data elements
    int[] ints; // array declaration
    ints = new ints[25]; // array construction at runtime.
  • Array declared, constructed and initialized at the same time.
    int[] ints = {1,2,3,4,5}; // array declaration,
  • An array of primitive data type created using the new keyword is automatically initialized. Each array element is initialized to its default value.
    For example,
    char[] arrayOfChars = new char[10];
  • Array of object references: An array of object references created using the new keyword is also initialized. Each array element is initialized to its default value, i.e. null.
    String[] names = new String[10];
  • length is a property of array (and not a method)
  • java.lang.Object is the superclass of an array

Argument passing during method calls

  • Always a copy of argument value is passed to calling method
  • Arguments of primitive data types: first, a copy of the passing variable is made and then it is passed. The original copy remains unaffected
  • Object reference as an argument: A copy of object reference is passed for method calls. It still points to the same object. The original copy is affected.

From: http://sitestree.com/?p=4862
Categories:Java Short Notes, SCJP
Tags:
Post Data:2008-07-28 12:18:41

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: Garbage Collection #Java Short Notes #SCJP

Garbage Collection

  • Java itself does memory management. You do not need to allocate memory at the time of object creation; also you do not need to free memory explicitly
  • Object is created either on the heap or on a stack
  • Memory heap: Objects created with new keyword are placed in heaps. This memory remains allocated throughout the life cycle of the object. When the object is no more referred, the memory becomes eligible for garbage collection
  • Stack: During method calls, objects are created for method arguments and method variables. These objects are created on stack. Such objects are eligible for garbage-collection when they go out of scope.
  • Garbage Collection is a low-priority thread in java
  • Garbage Collection cannot be forced explicitly. JVM may do garbage collection if it is running short of memory.
  • The call System.gc() does NOT force the garbage collection but only suggests that the JVM may make an effort to do garbage collection.
  • Garbage Collection is hardwired in Java runtime system. Java runtime system keeps the track of memory allocated. Therefore, it is able to determine if memory is still usable by any live thread. If not, then garbage collection thread will eventually release the memory back to the heap.
  • Garbage Collection usually adopts an algorithm, which gives a fair balance between responsiveness (how quickly garbage-collection thread yields?) and speed of memory recovery (important for memory-intensive operations). Responsiveness is especially important in real time systems.
  • An object is eligible for garbage collection when no object refers to it.
  • An object also becomes eligible when its reference is set to null. (Actually all references to the object should be null for it to be eligible.)
  • The objects referred by method variables or local variables are eligible for garbage collection when the method or their container block exits

From: http://sitestree.com/?p=4863
Categories:Java Short Notes, SCJP
Tags:
Post Data:2009-03-10 13:59:45

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: Some links: useful for exams like scjp/scja #Java Short Notes #SCJP #Blog

Assertions in Java: http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
Enum in Java:http://www.java2s.com/Code/Java/Language-Basics/Enum.htm
StringBuffer and StringBuilder Classes have similar methods where StringBuffer is synchronized: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html
Serialize and Deserialize: http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html
java.util package is very important: http://java.sun.com/j2se/1.4.2/docs/api/java/util/package-summary.html

From: http://sitestree.com/?p=4845
Categories:Java Short Notes, SCJP, Blog
Tags:
Post Data:2013-06-11 18:38:25

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

Pretty Simple Java Code #SCJP


/**
 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
 */

class HelloWorldApp {

	public static void main(String[] args) {
		System.out.println("Hello Worlld");
	}

}

class ArrayDemo {
    public static void main(String[] args) {
        // declares an array of integers
        int[] anArray;
        int[] theArray;

        // allocates memory for 10 integers
        anArray = new int[10];
        theArray = new int[30];
           
        // initialize first element
        anArray[0] = 100;
        // initialize second element
        anArray[1] = 200;
        // and so forth
        anArray[2] = 300;
        anArray[3] = 400;
        anArray[4] = 500;
        anArray[5] = 600;
        anArray[6] = 700;
        anArray[7] = 800;
        anArray[8] = 900;
        anArray[9] = 1000;

        System.out.println("Element at index 0: "
                           + anArray[0]);
        System.out.println("Element at index 1: "
                           + anArray[1]);
        System.out.println("Element at index 2: "
                           + anArray[2]);
        System.out.println("Element at index 3: "
                           + anArray[3]);
        System.out.println("Element at index 4: "
                           + anArray[4]);
        System.out.println("Element at index 5: "
                           + anArray[5]);
        System.out.println("Element at index 6: "
                           + anArray[6]);
        System.out.println("Element at index 7: "
                           + anArray[7]);
        System.out.println("Element at index 8: "
                           + anArray[8]);
        System.out.println("Element at index 9: "
                           + anArray[9]);
        
        
        byte[] anArrayOfBytes;
        short[] anArrayOfShorts;
        long[] anArrayOfLongs;
        float[] anArrayOfFloats;
        double[] anArrayOfDoubles;
        boolean[] anArrayOfBooleans;
        char[] anArrayOfChars;
       
        		
        		
    }
} 


/*class ArrayCopyDemo {
    public static void main(String[] args) {
        char[] copyFrom = { 'd', 'e', 'c', 'a', 'f', 'f', 'e',
			    'i', 'n', 'a', 't', 'e', 'd' };
        char[] copyTo = new char[7];

        System.arraycopy(copyFrom, 2, copyTo, 0, 7);
        System.out.println(new String(copyTo));
    }
}
*/

class ArrayCopyDemo {
	
	public static void main(String[] args) {
		char[] copyFrom = {'a','b','c','d','e','f'};
		char[] copyTo = new char[10];
		
		System.arraycopy(copyFrom, 0, copyTo, 1,3);
		System.out.println(new String(copyTo));
	}
}



/*
class ArrayCopyOfDemo {
    public static void main(String[] args) {        
        char[] copyFrom = {'d', 'e', 'c', 'a', 'f', 'f', 'e',
            'i', 'n', 'a', 't', 'e', 'd'};
            
        char[] copyTo = java.util.Arrays.copyOfRange(copyFrom, 2, 9);
        
        System.out.println(new String(copyTo));
    }
}*/


class ArrayCopyOfDemo {
	public static void main (String[] args) {
		char[] copyFrom = {'d', 'e', 'c', 'a', 'f', 'f', 'e',
	            'i', 'n', 'a', 't', 'e', 'd'};
		
		char[] copyTo = java.util.Arrays.copyOfRange(copyFrom, 2, 7); 
		System.out.println(copyTo);
		
	}
}



/*
class MultiDimArrayDemo {
    public static void main(String[] args) {
        String[][] names = {
            {"Mr. ", "Mrs. ", "Ms. "},
            {"Smith", "Jones"}
        };
        // Mr. Smith
        System.out.println(names[0][0] + names[1][0]);
        // Ms. Jones
        System.out.println(names[0][2] + names[1][1]);
    }
}*/


class MultiDimArrayDemo {
	public static void main (String[] args) {
		String[][] names = {
				{"mr", "smith", "ms"},
				{"smith", "jones"}
		};
		
		System.out.println(names[0][1]);
	}
	
}

From: http://sitestree.com/?p=10873
Categories:SCJP
Tags:
Post Data:2017-07-19 18:16: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: Sun Certified Java Programmer: All that you need to know #SCJP

From: http://sitestree.com/?p=5213
Categories:SCJP
Tags:
Post Data:2013-02-13 20:16:32

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: Topics and Resources : will be continued #SCJP

SCJP topics and related resources are provided. I have skimed through the resources at least one time.

Garbage Collection

Parameter Passing

Command Line Parameter

Access Modifiers, Package Declaration, Import

Concurrency:java.lang.Thread and java.lang.Runnable

Java Thread:wait/notify/notifyall-lock

OOP Concept 1

From: http://sitestree.com/?p=4852
Categories:SCJP
Tags:
Post Data:2011-03-09 21:03:34

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 Operators #SCJP

By Sayed

Exams like SCJP test your understanding of Java operators and how to use them like:
assignment operators: =, +=, -=
arithmetic operators: +, -, *, /, %, ++, --
relational operators: <, <=, >, >=, ==, !=
logical operators: &, |, ^, !, &&, ||
conditional operators: ? :
Also operators to check the equality of two objects or two primitives

In the following table operators and their precedences are shown. Upper rows operators have higher precedence. Same row operators have equal precedence. For equal precedence operators, All binary operators except the assignment operators work from left to right while assignment operators work from right to left.

 

Operator Precedence
Operators Precedence
postfix expr++ expr--
unary ++expr --expr +expr -expr ~ !
multiplicative * / %
additive + -
shift << >> >>>
relational < > <= >= instanceof
equality == !=
bitwise AND &
bitwise exclusive OR ^
bitwise inclusive OR |
logical AND &&
logical OR ||
ternary ? :
assignment = += -= *= /= %= &= ^= |= <<= >>= >>>=

The following quick reference summarizes the operators supported by the Java programming language.

Simple Assignment Operator

=	Simple assignment operator

Arithmetic Operators

+ 	Additive operator (also used for String concatenation)
- 	Subtraction operator
*	Multiplication operator
/ 	Division operator
%	Remainder operator

Unary Operators

+ 	Unary plus operator; indicates positive value (numbers are positive without this, however)
- 	Unary minus operator; negates an expression
++  	Increment operator; increments a value by 1
--    	Decrement operator; decrements a value by 1
!     	Logical compliment operator; inverts the value of a boolean

Equality and Relational Operators

==	Equal to
!=	Not equal to
>	Greater than
>=	Greater than or equal to
<	Less than
<=	Less than or equal to

Conditional Operators

&& 	Conditional-AND
|| 	Conditional-OR
?:      Ternary (shorthand for if-then-else statement)

Type Comparison Operator

instanceof	Compares an object to a specified type 

Bitwise and Bit Shift Operators

~	Unary bitwise complement
<<	Signed left shift
>>	Signed right shift
>>>	Unsigned right shift
&	Bitwise AND
^	Bitwise exclusive OR
|	Bitwise inclusive OR

From: http://sitestree.com/?p=3643
Categories:SCJP
Tags:
Post Data:2016-07-17 08:33:36

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