Monday, May 31, 2010

Avantages of Object Oriented Programming Languages (OOPL)

I have updated in http://www.freejavaclass.com/

The Object Oriented Programming Languages directly represent the real life objects like Car, Jeep, Account,
Customer etc. The features of the OO programming languages like polymorphism, inheritance and
enapsulation make it powerful. [Tip: remember pie which, stands for Polymorphism, Inheritance and
Encapsulation are the 3 pillars of OOPL]

You can determine all the keys in a Map in the following way

I have updated in www.freejavaclass.com

By getting a Set object from the Map and iterating through it

The order of access modifiers from least restrictive to most restrictive

I have updated in http://www.freejavaclass.com/

public, protected, default, private

What is UNICODE?

I have updated in http://www.freejavaclass.com/

Unicode is used for internal representation of characters and strings and it uses 16 bits to represent each other.

What is the difference between constructor and method?

I have updated in http://www.freejavaclass.com/

Constructor will be automatically invoked when an object is created whereas method has to be called explicitly.

What is an Object and how do you allocate memory to it?

I have updated in http://www.freejavaclass.com/

Object is an instance of a class and it is a software unit that combines a structured set of data with a set of operations for inspecting and manipulating that data. When an object is created using new operator, memory is allocated to it.

What are native operating system threads?

I have updated in http://www.freejavaclass.com/

Native operating system threads are those provided by the computer operating system that plays host to a Java application, be it Windows, Mac or GNU/Linux. Operating system threads enable computers to run many programs simultaneously on the same central processing unit (CPU) without clashing over the use of system resources or spending lots of time running one program at the expense of another. Operating system thread management is usually optimised to specific microprocessor architecture and features so that it operates much faster than Java green thread processing.

What is a green thread?

I have updated in http://www.freejavaclass.com/

A green thread refers to a mode of operation for the Java Virtual Machine (JVM) in which all code is executed in a single operating system thread. If the Java program has any concurrent threads, the JVM manages multi-threading internally rather than using other operating system threads. There is a significant processing overhead for the JVM to keep track of thread states and swap between them, so green thread mode has been deprecated and removed from more recent Java implementations. Current JVM implementations make more efficient use of native operating system threads.

What is a working thread?

I have updated in http://www.freejavaclass.com/

A working thread, more commonly known as a worker thread is the key part of a design pattern that allocates one thread to execute one task. When the task is complete, the thread may return to a thread pool for later use. In this scheme a thread may execute arbitrary tasks, which are passed in the form of a Runnable method argument, typically execute(Runnable). The runnable tasks are usually stored in a queue until a thread host is available to run them. The worker thread design pattern is usually used to handle many concurrent tasks where it is not important which finishes first and no single task needs to be coordinated with another. The task queue controls how many threads run concurrently to improve the overall performance of the system. However, a worker thread framework requires relatively complex programming to set up, so should not be used where simpler threading techniques can achieve similar results.

How can instantiate Java interface without implementing.

public interface Foo { String method(); } public class Claaa {    public static void main(String[] args) {     Foo fooByIC...