Posts

Showing posts from 2011

What is an interface?

Interface is a reference type which consists of only method declarations and constants. All methods in interface by default public abstract and all fields are public static final eventhough it has not been mentioned explicitly. Example: public interface Car { int wheel=4; int paintCar(String color); int driveCar(); }

Why String is immutable in java?

1)Imagine StringPool facility without making string immutable , its not possible at all because in case of string pool one string object/literal e.g. "Test" has referenced by many reference variables , so if any one of them change the value others will be automatically gets affected i.e. lets sayString A = "Test"String B = "Test" Now String B called "Test".toUpperCase() which change the same object into "TEST" , so A will also be "TEST" which is not desirable. 2)String has been widely used as parameter for many java classes e.g. for opening network connection you can pass hostname and port number as stirng , you can pass database URL as string for opening database connection, you can open any file by passing name of file as argument to File I/O classes.In case if String is not immutable , this would lead serious security threat , I mean some one can access to any file for which he has authorization and then can change the file...

Asynchronous Messaging

Asynchronous messaging describes communications that takes place between two applications or systems, where the system places a message in a message queue (called an Event Queue in enterprise messaging systems ) and does not need to wait for a reply to continue processing. Contrast with synchronous messaging .

Asynchronous Messaging

Asynchronous messaging describes communications that takes place between two applications or systems, where the system places a message in a message queue (called an Event Queue in enterprise messaging systems ) and does not need to wait for a reply to continue processing. Contrast with synchronous messaging .

Understanding Java Memory Settings

As part of the Best Practices, we know that we should be setting -Xms & -Xmx Java command line parameters. What are these settings and why is it required to set these. As JAVA starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All JAVA applications (including IQv6) by default allocates & reserves up to 64 MB of memory resource pool from the system on which it is running. The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory. The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory ...

Understanding java Memory settings

As part of the Best Practices, we know that we should be setting -Xms & -Xmx Java command line parameters. What are these settings and why is it required to set these. As JAVA starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All JAVA applications (including IQv6) by default allocates & reserves up to 64 MB of memory resource pool from the system on which it is running. The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory. The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory ...

What are PermSize and MaxPermSize and how they work in Java.

Permanent Generation (which is “Perm” in PermSize) The permanent generation is used to hold reflective of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations. Generally, sizing of this generation can be ignored because the default size is adequate. However, programs that load many classes may need a larger permanent generation. PermSize is additional separate heap space to the -Xmx value set by the user. The section of the heap reserved for the permanent generation holds all of the reflective data for the JVM. You should adjust the size accordingly if your application dynamically load and unload a lot of classes in order to optimize the performance. By default, MaxPermSize will be 32mb for -client and 64mb for -server. However, if you do not set both PermSize and MaxPermSize, the overall heap will not increase unless it is needed. When you set both...

OOPS Concepts with realtime examples

1. Abstraction Abstraction helps to hide the non essential features from the user and makes the application user friendly. Eg. Take your mobile phone. You are having buttons and know the purpose but no need to understand how it prints number on the screen when it is pressed. 2. Encapsulation It bundles the code into a single unit which makes the code very easy to handle. Eg. Take computer keyboard. All the buttons have been enclosed. 3. Inheritance It helps to inherit the superclass properties to subclasses. Eg. Father - Son relationship. 4. Polymorphism A entity which behaves differntly at different places. Eg. A person behaves as a good husband in family. He behaves as a good employee at company. He also behaves as a good citizen in public

Object Oriented Concepts

There are four main object oriented concepts in java. 1. Abstraction 2. Encapsultion 3. Inheritance 4. Polymorphism