Saturday, October 20, 2012
Sunday, October 14, 2012
Core Java Faq
1) Difference between path and classPath in java
2) Dynamic Loading vs Static Class Loading in java
3) Overloading in java
4) Overriding in java
5) static variables in java
6) static methods in java
7) can static methods be overloaded
8) can static methods be overrided
9) can static methods be overloaded by non-static methods
10) can static methods be overrided by non-static methods
11) static class
2) Dynamic Loading vs Static Class Loading in java
3) Overloading in java
4) Overriding in java
5) static variables in java
6) static methods in java
7) can static methods be overloaded
8) can static methods be overrided
9) can static methods be overloaded by non-static methods
10) can static methods be overrided by non-static methods
11) static class
Saturday, October 13, 2012
Dynamic Loading vs Static Class Loading in java
Class in java can be loaded in two ways
Static means at compile time means using new operator.
Dynamic means using class.forname() a class is loaded dynamically during run time
so a decision to load a class dynamically at run time can be taken based on certain logic using property file etc.
getClass(); getName(); getDeclaredFields();
Instance can also be created using forName() method. It loads the class into the current class memory.
Instance can also be created using forName() method. It loads the class into the current class memory.
it is similar like Reflection.
Difference between path and classPath in java
We always set a path and classpath while coding using java.
Path is for the OS to know where the java exe's are. by setting path you can execute java program from anywhere if not set then u need to go to bin directory of java and only then u can execute a java program.
Classpath is for the java program to know where the .class file are.
Classpath location points to where the .class file of your java programs are and /or the jar files (they contain the .class file used to code a specific functionality/usage)
Path is for the OS to know where the java exe's are. by setting path you can execute java program from anywhere if not set then u need to go to bin directory of java and only then u can execute a java program.
Classpath is for the java program to know where the .class file are.
Classpath location points to where the .class file of your java programs are and /or the jar files (they contain the .class file used to code a specific functionality/usage)
Thursday, August 23, 2012
Subscribe to:
Posts (Atom)