You are here:   HomeJava ProgrammingIntroduction to Java
by Dinesh Thakur Category: Introduction to Java

The different languages reflect the different styles of programming. Procedural programming decomposes a program into various different functional units, each of which can gather and manipulate data as needed.

 
by Dinesh Thakur Category: Introduction to Java

Java is the object oriented, similar to C++ high-level programming language and architecture neutral developed by Sun Microsystems. Java was originally called OAK. Object Oriented meaning the capability to reuse code. Secondly, it is platform independent i.e. we don't have to develop separate applications for different platforms. It is possible to develop a single application which can run on multiple platforms like Windows, UNIX, and Macintosh systems. Java was designed for hand-held devices and set-top boxes.



 
by Dinesh Thakur Category: Introduction to Java

Inheritance is a compile-time mechanism in Java that allows you to extend a class (called the base class or superclass) with another class (called the derived class or subclass). In Java,inheritance is used for two purposes:



 
by Dinesh Thakur Category: Introduction to Java

Initializing a variable is considered very helpful while making programs. We can initialize variables of primitive types at the time of their declarations. For example:

 
by Dinesh Thakur Category: Introduction to Java

'this' pointer is used when a method has to refer to an object that has invoked it. 'this' pointer can be used inside any method to refer to the current object. This means that this is always used as a reference to the object on which the method was invoked. We can use this anywhere as reference to an object of the current class type is permitted. Since, it is illegal in Java to declare two local variables with the same name inside the same or enclosing scopes; we can have local variables, which include formal parameters to methods, which may overlap with the names of the class instance variables. However, when a local variable has the same name as an instance variable, the local variable hides the instance variable.



 
by Dinesh Thakur Category: Introduction to Java

Enumeration (enum) was not originally available in Java though it was available in other language like C and C++ but eventually Java realized and introduced Enum on JDK 5 (Tiger) by keyword enum



 
by Dinesh Thakur Category: Introduction to Java

Polymorphism gives us the ultimate flexibility in extensibility. The abiltiy to define more than one function with the same name is called Polymorphism. In java,c++ there are two type of polymorphism:



 
by Dinesh Thakur Category: Introduction to Java

Modifiers are keywords used to define the scope and behaviour of classes, methods and variables in Java. Access modifiers specified who can access them. Java has a wide variety of modifiers that can be categorized as shown below:



 
by Dinesh Thakur Category: Introduction to Java

The encapsulation is achieved by combining the methods and attribute into a class.The class acts like a container encapsulating the properties. The users are exposed mainly public methods.The idea behind is to hide how thinigs work and just exposing the requests a user can do.

 
by Dinesh Thakur Category: Introduction to Java

In this Example we Reading amount, Year and interest in the class Scanner becomes analogous to reading string. In this example, the three numbers are read from the console, and then perform Simple Interest,Compound Interest operations and results printed on the screen in formatted output.

 

Page 1 of 3



Subscribe To Free Daily Newsletter!

Get Free News Updates Delivered Directly To Your Inbox
About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to contact us.



What's New and Popular