Wednesday, 3 February 2016

Windows Command Prompt Essential Tips and Tricks

1. How to open new command window in same location

start cmd /K




Sunday, 31 January 2016

How to debug web application remotely from tomcat server on eclipse

Go to monitor tomcat update java option with following properties :

-Dcatalina.home=D:\Tomcat7.0.42
-Dcatalina.base=D:\Tomcat7.0.42
-Djava.endorsed.dirs=D:\Tomcat7.0.42\endorsed
-Djava.io.tmpdir=D:\Tomcat7.0.42\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=D:\Tomcat7.0.42\conf\logging.properties
-Xdebug
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
-XX:MaxPermSize=256m



8000 is default port for remote debug for eclipse.




Next goto eclipse and configure remote debug :-

Run  >  Debug Configuration >
Create a new Remote Java Application using new launch configuration,
Select the project to debug



Put breakpoints on eclipse and you are ready to debug.

Wednesday, 28 August 2013

Difference between Static and Dynamic binding in java

Difference between Static and Dynamic binding in java

1) Static binding in Java occurs during Compile time while Dynamic binding occurs 
    during Runtime.

2) private, final and static methods and variables uses static binding and bonded by compiler while virtual methods are bonded during runtime based upon runtime object.

3) Static binding uses Type(Class in Java)  information for binding while Dynamic binding uses Object to resolve binding.

3) Overloaded methods are bonded using static binding while overridden methods are bonded using dynamic binding at runtime.



Can we overload and override main method in java

Can we overload main() method in java:
Yes we can !!

But only public static void main(String[] args) will be used when your class is launched by JVM , as :- 


But it will always print 
main(String[] args)

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

    public static void main(String arg1) {
        System.out.println("main(String arg1)");
    }

    public static void main(String arg1, String arg2) {
        System.out.println("main(String arg1, String arg2)");
    }
}


We can call the main() method yourself from code, of course - at which point the normal overloading rules will be applied. 
Note that you can use a varargs signature, as that's equivalent from a JVM standpoint: -
public static void main(String... args)


Can we override the main method in java

No!
main is a static method, and is thus not polymorphic. You may hide it be defining another static main method in a subclass, though.

Saturday, 8 December 2012

The Escape


Our mind has always been a thing of great possibility , in ancient ramayana it has been described as most fastest thing in the world ie. to say we cannot restrict the mind from moving , we can confine a person but can't confine his thoughts , we can punish a culprit on doing a wrong thing but can't make his brain regret for his deeds , this irony has always been a thing of great discussion .

When we are child every child wants to be a person who he or see things to be superior , ie. a child want to grow young like his father or teacher so that other don't scold or order him , this thought comes in his mind because he thinks being more old would make him escape from all sufferings of being so small and being ordered by others , but when the same kid grow he thinks to become a little kid  once again so that he can run from all those task of school homeworks , he things being a kid is more better than being at this age as , when he was a kid people used to fulfill all his wishes and now as a big lad he has landed into a world of responsibilities where people always want him to act mature.

Man always want or like thing which is not available to him , when you don't have a car you crave for it but when you have your car and at that time, you think of the time you traveled by your bicycle. When you see a beautiful girl you think her to be your girlfriend and when the same girl becomes your wife you fall into everyday quarrel with her and think life would have been better without her. When at job you everyday blame your task to be bit tough and, when you see another man doing other job you are attracted by it, to illustrate when a doctor sees an engineer he thinks his profession more better than his medical profession as he is amazed by the exploring and new things in the engineers life. He considers his life to be boring, and in this way his mind always moves on and on.

We have made our mind evolved in such a way that it dons't want to be satisfied by whatever thing he has got, man in this process forgets to enjoy his life , why can't the little child be happy being kid, if he is made to understand at his childhood the fruits of being whatever he is, the same kid won't complain his life when he grow old. But how can this be done, its really easy when as a kid the child should be made believe in himself, moreover he should never be ordered unwillingly and if to be ordered or punished it should be done in proper way so that he should accept the prize he get for his deed but not complain for his deeds.

And if a persons mind starts liking what he or she is, life would turn a heaven for him, the same person will praise his life for being blessed with such a beautiful wife. And the same doctor who does'nt like his job would feel fortunate serving patient. It's the mind which govern our life, if it dos'nt escape from the present, life will turn out to be a blessing and world would seem to be a heaven.

Thursday, 9 February 2012

Java rare practice programs for beginners

Sample programs

  • Area
  • Program to calculate Biggest no from given 3 no's
  • Prime Number
  • Program to Determine Palindrome