29-06-2013, 04:30 PM
Java Solutions
Java Solutions.pdf (Size: 2.6 MB / Downloads: 37)
Java byte code power :
As java compiler internally convert the java
source code into byte code , and this byte code is platform independent
means byte code generated by java compiler can be accessible in every
platform that install java virtual machine.
Robust
Memory leaks cannot happen, pointer cannot freak around in the memory.
This happenes because java itself have the responsibily of garbage collection
, we can allocate memory using constructor in java , but java itself collected
back this memory when object are not reachable .
And exception handling is much more powerful in java as compared to
previous languages , thats make the java robust.
java is platform independent
What is the meaning of platform independence ?
Platform independence technically means We don’t need to recompile our
application across platforms. For Example , it we write a c code and save it
as A.c , the after compiling this c code we get A.exe. A.c and A.exe both are
not portable across operating system .
now in java world.
If we write A.java and compiled it using javac compiler , then it creates
A.class , A.java and A.class both are same for windows and unix or for that
matter any platform. but windows and unix don’t understand A.class.to
make windows and unix understand A.class , we need to use something
called JVM. JVM is not same for windows and unix.jvm is platform
dependant we don’t need to think about it, because we don’t build jvm's.
JVM is compulsorily required to run java programs. JVM is like an
intermediary between Os and the java program. so we got a intermediary, so
we got slowness. So java is slow.
Comments
A program can be documented by inserting comments at relevant places .
these comments are ignored by the compiler. It is not considered as a coding
part of a project .
Java provides three types of comments
• Single Line comment
• Multi line comments or Block Comment
• A documentation (or Javadoc) Comment
Selection Statements
Java provides selection statements that allow the program to choose
between alternative actions during execution. The choice is based on criteria
specified in the selection statement. These selection statements are
· simple if Statement
· if-else Statement
· switch Statement