Super keyword in java
Super keyword in java is a reference variable that is used to refer parent class object. Super is an implicit keyword create by JVM and supply each and every java program for performing important role in three places.
At variable level
At method level
At constructor level
Need of super keyword:
Whenever the derived class is inherits the base class features, there is a possibility that base class features are similar to derived class features...
Java Tutorial, Java Study, Learn Java, Java Lab@home, Java Cycle test, Java Projects, Java Assignments, Java Notes and much more..
Saturday, 13 May 2017
JP - This Keyword ~ foundjava
This keyword in java
this is a reference variable that refers to the current object. It is a keyword in java language represents current class object
Usage of this keyword
It can be used to refer current class instance variable.
this() can be used to invoke current class constructor.
It can be used to invoke current class method (implicitly)
It can be passed as an argument in the method call.
It can be passed as argument in the constructor call.
It can also be used to return...
JP - Static Keyword ~ foundjava
Static keyword in java
The static keyword is used in java mainly for memory management. It is used with variables, methods, blocks and nested class. It is a keyword that are used for share the same variable or method of a given class. This is used for a constant variable or a method that is the same for every instance of a class. The main method of a class is generally labeled static.
No object needs to be created to use static variable or call static methods, just put the...
JP - Final Keyword ~ foundjava
Final keyword in java
It is used to make a variable as a constant, Restrict method overriding, Restrict inheritance. It is used at variable level, method level and class level. In java language final keyword can be used in following way.
Final at variable level
Final at method level
Final at class level...
JP - Array in Java ~ foundjava
Array in java
Array is a collection of similar type of data. It is fixed in size means that you can't increase the size of array at run time. It is a collection of homogeneous data elements. It stores the value on the basis of the index value.
Advantage of Array
One variable can store multiple value: The main advantage of the array is we can represent multiple value under the same...
JP - Access Modifiers ~ foundjava
Access Modifiers in Java
Access modifiers are those which are applied before data members or methods of a class. These are used to where to access and where not to access the data members or methods. In Java programming these are classified into four types:
Private
Default (not a keyword)
Protected
Public
Note: Default is not a keyword (like public, private, protected are keywor...
JP - Import Statements ~ foundjava
Import statements in Java
Import is a keyword in java language used to import the predefined properties of java API into current working java program...
JP - Naming Conversion ~ foundjava
Naming Conversion of Java
Sun micro system was given following conversions by declaring class, variable, method etc. So that it is highly recommended to follow this conversion while writing real time code.
Why Using naming Conversion
Different Java programmers can have different styles and approaches to write program. By using standard Java naming conventions they make their code easier to read for themselves and for other programmers. Readability of Java code is important because...
JP - Wrapper Classes ~ foundjava
Wrapper classes in java
For each and every fundamental data type there exist a pre-defined class, Such predefined class is known as wrapper class. The purpose of wrapper class is to convert numeric string data into numerical or fundamental data.
Why use wrapper classes ?
We know that in java whenever we get input form user, it is in the form of string value so here we need to convert these string values in different different datatype (numerical or fundamental data), for this conversion...
JP - Looping statements ~ foundjava
Looping Statement in Java
Looping statement are the statements execute one or more statement repeatedly several number of times. In java programming language there are three types of loops; while, for and do-while.
Why use loop ?
When you need to execute a block of code several number of times then you need to use looping concept in Java language.
Advantage with looping statement
Reduce length of Code
Take less memory space.
Burden on the developer is reducing.
Time consuming...
JP - Decision making statements ~ foundjava
Decision Making Statement in Java
Decision making statement statements is also called selection statement. That is depending on the condition block need to be executed or not which is decided by condition. If the condition is "true" statement block will be executed, if condition is "false" then statement block will not be executed. In java there are three types of decision making statement.
if
if-else
switch
if-then Statement
if-then is most basic statement of Decision making...
JP - SOP Statements ~ foundjava
System.out.println() in Java
In java language print() and println() are the predefined non-static method of printStream class used to display value or message either in the same line or line by line respectively. PrintStream class is having fixed object reference in the System class (existing as a static properties) so that either print() or println() method can be...
JP - CMD Arguments ~ foundjava
Command Line Arguments in Java
If any input value is passed through the command prompt at the time of running of the program is known as command line argument by default every command line argument will be treated as string value and those are stored in a string array of main() method.
Syntax for Compile and Run CMD programs
Compile By -> Javac Mainclass.java
Run By -> Java ...
JP - Main() Method ~ foundjava
Main() Method in Java
main() method is starting execution block of a java program or any java program start their execution from main method. If any class contain main() method known as main class.
Syntax of main() method:
Syntax
public static void main(String args[])
{
.......
.......
} ...
JP - Java Program Structure ~ foundjava
Structure of Java Program
Structure of a java program is the standard format released by Language developer to the Industry programmer.
Sun Micro System has prescribed the following structure for the java programmers for developing java application...
JP - Operators in Java ~ foundjava
Operators in Java
Operator is a special symbol that tells the compiler to perform specific mathematical or logical Operation. Java supports following lists of operators.
Arithmetic Operators
Relational Operators
Logical Operators
Bitwise Operators
Assignment Operators
Ternary or Conditional Operat...
JP - Variables in Java ~ foundjava
Variable Declaration Rules in Java
Variable is an identifier which holds data or another one variable is an identifier whose value can be changed at the execution time of program. Variable is an identifier which can be used to identify input data in a program...
JP - Datatypes in Java ~ foundjava
Data Type in Java
Datatype is a spacial keyword used to allocate sufficient memory space for the data, in other words Data type is used for representing the data in main memory (RAM) of the computer.
In general every programming language is containing three categories of data types. They are
Fundamental or primitive data types
Derived data types
User defined data typ...
JP - Object and Class ~ foundjava
Object and class in Java
Object is the physical as well as logical entity where as class is the only logical entity.
Class: Class is a blue print which is containing only list of variables and method and no memory is allocated for them. A class is a group of objects that has common properties.
A class in java contains:
Data Member
Method
Constructor
Block
Class and Interf...
JP - JVM Architecture ~ foundjava
JVM Architecture in Java
JVM (Java Virtual Machine) is a software. It is a specification that provides Runtime environment in which java bytecode can be executed...
JP - JDK JVM JRE ~ foundjava
Difference between JDK, JVM and JRE
Jvm, Jre, Jdk these all the backbone of java language. Each components have separate works. Jdk and Jre physically exists but Jvm are abstract machine it means it not physically exists...
JP - Compile and execute ~ foundjava
Compile and Run Java Program
In the Java programming language, all source code is first written in plain text files and save with the .java extension. After compilation, .class files are generated by javac compiler. A .class file does not contain code that is native to your processor; it instead contains bytecodes (it is machine language of the Java Virtual Machine1...
JP - First java Program ~ foundjava
First Java Program
Requirements for java Program
For executing any java program we need given things.
Install the JDK any version if you don't have installed it.
Set path of the jdk/bin directory.
Create the java program
Compile and run the java program
Steps For compiling and executing the java program
Java is very simple programming language first we write a java program and save it with program class nam...
JP - Platform Independent ~ foundjava
How Java is Platform Independent
A programming language or technology is said to be platform independent if and only if which can run on all available operating systems with respect to its development and compilation. (Platform represents Operating System).
Java is a platform independent programming language, Because when you install jdk software on your system then automatically JVM are installed on your system. For every operating system separate JVM is available which is capable...
JP - Path vs Classpath ~ foundjava
Difference between path and classpath in Java
Path
Path variable is set for providing path for all Java tools like java, javac, javap, javah, jar, appletviewer. In Java to run any program we use java tool and for compile Java code use javac tool. All these tools are available in bin folder so we set path upto bin folder.
classpath
classpath variable is set for providing path of all Java classes which is used in our application. All classes are available...
JP - Environment Setup ~ foundjava
How to Set Path and Classpath in Java
Path Variable
Path variable is set for providing path for all Java tools like java, javac, javap, javah, jar, appletviewer which are used in java programming. All these tools are available in bin folders so we set path upto bin folders.
Classpath Variable
Classpath variable is set for providing a path for predefined Java classes which is used in our application. All classes are available in lib/rt.jar so we set classpath...
JP - Features of Java ~ foundjava
Features of Java
Features of a language are nothing but the set of services or facilities provided by the language vendors to the industry programmers. Some important features of java are...
JP - Basic Points ~ foundjava
Basic Points of Java
Java is a platform independent, more powerful, secure, high performance, multithreaded programming language. Here we discuss some points related to Java.
Define byte
Byte code is the set of optimized instructions generated during compilation phase and it is more powerful than ordinary pointer code.
Define JRE
The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK). It contains a set of libraries and tools for developing Java...
JP - Overview of Java ~ foundjava
Overview of Java
Java is one of the programming language or technology used for developing web applications. Java language developed at SUN Micro Systems in the year 1995 under the guidance of James Gosling and there team. Originally SUN Micro Systems is one of the Academic university (Standford University Network)
Whatever the software developed in the year 1990, SUN Micro Systems has released on the name of oak, which is original name of java (scientifically oak is one of the tree...
JP - History of Java ~ foundjava

History of Java
Java language developed by company Sun Microsystems and the creator is Jamesh Gosling.
Story behind development of Java
Sun Microsystems Started by a group of the students who are studing in Standard University. These people found the problem in their room with electronic consumable remote. That means one electronic consumable control doesn't work on another...
JP - Java Home ~ foundjava
Java Tutorial
It is one of the programming language or technology used for developing web applications. Using this technology you can develop distributed application. A Java language developed at SUN Micro Systems in the year 1995 under the guidance of James Gosling and their team. In other word It is a programming language suitable for the development of web applications. It is also used for developing desktop and mobile applicatio...
Basics of Java ~ foundjava
Basic Points of Java
Java is a platform independent, more powerful, secure, high performance, multithreaded programming language. Here we discuss some points related to Java.
Define byte
Byte code is the set of optimized instructions generated during compilation phase and it is more powerful than ordinary pointer code.
Define JRE
The Java Runtime Environment (JRE) is part of the Java Development Kit (JDK). It contains a set of libraries and tools for developing Java...
Connecting to Oracle using Thin Driver ~ foundjava

Connecting to Oracle Database using Thin Driver
To connect a Java application with Oracle database using Thin Driver. You need to follow the following steps
Load Driver Class: The Driver Class for oracle database is oracle.jdbc.driver.OracleDriver and Class.forName("oracle.jdbc.driver.OracleDriver") method is used to load the driver class for Oracle database.
Create Connection: For...
Connecting to Access using Type-1 Driver ~ foundjava

Connecting to Access Database using Type-1 Driver
To connect a Java application with Access database using JDBC-ODBC Bridge(type-1) Driver. You need to follow the following steps
Create DSN Name
Go to control pane...
Steps to Connect to Database ~ foundjava

Steps to connect a Java Application to Database
The following 5 steps are the basic steps involve in connecting a Java application with Database using JDBC.
Register the Driver
Create a Connection
Create SQL Statement
Execute SQL Statement
Closing the connection
...
SQL Package ~ foundjava
JDBC 4.0 API
JDBC 4.0 API is mainly divided into two package
java.sql
javax.sql
java.sql package
This package include classes and interface to perform almost all JDBC operation such as creating and executing SQL Queries.
Important classes and interface of java.sql pack...
JDBC ~ foundjava

Introduction to JDBC
Java Database Connectivity(JDBC) is an Application Programming Interface(API) used to connect Java application with Database. JDBC is used to interact with various type of Database such as Oracle, MS Access, My SQL and SQL Server. JDBC can also be defined as the platform-independent interface between a relational database and Java programming. It allows java...
Thursday, 4 May 2017
RMI ~ foundjava
Remote method invocation(RMI) allow a java object to invoke method on an object running on another machine. RMI provide remote communication between java program. RMI is used for building distributed application.
Concept of RMI application
A RMI application can be divided into two part,Client program and Server program. A Server program creates some remote object, make their references available for the client to invoke method on it. A Client program...
Reflection classes ~ foundjava
java.lang.Class class
Class is a final class in java.lang package which extends Object class. Instance of this class represents classes and interfaces in a running Java application. It is used to analyze and change dynamic behaviour of a class at runtime.
Some Important Methods of java.lang.Class class
This class defines several methods using which we can get information about methods, constructors, modifiers and members of a...
Introduction to Reflection ~ foundjava
Reflection API
Reflection means ability of a software to analyze itself. In Java, Reflection API provides facility to analyze and change runtime behaviour of a Class, at runtime.
For example, using reflection at the runtime you can determine what method, field, constructor or modifers a class supports.
What is reflect package ?
java.lang.reflect package encapsulates several important interfaces and classes. These classes and interface define methods which are used for refl...
Swing Component ~ foundjava
Swing Framework contains a large set of components which provide rich functionalities and allow high level of customization. All these components are lightweight components. They all are derived from JComponent class. It supports the pluggable look and feel.
JButton
JButton class provides functionality of a button. JButton class has three constuctors,
JButton(Icon ic)
JButton(String str)
JButton(String str, Icon ic)
It allows a button to be created using icon, a...
Swing ~ foundjava
Swing Framework contains a set of classes that provides more powerful and flexible GUI components than those of AWT. Swing provides the look and feel of modern Java GUI. Swing library is an official Java GUI tool kit released by Sun Microsystems. It is used to create graphical user interface with Java.
Main Features of Swing Toolkit
Platform Independent
Customizable
Extensible
Configurable
Lightwei...
AWT ~ foundjava
AWT contains large number of classes and methods that allows you to create and manage windows GUI application. AWT is the foundation upon which Swing is made. It is used for GUI programming in Java. But now a days it is merely used because most GUI java programs are implemented using Swing because of its rich implementation of GUI controls and light-weighted nature.
AWT Hi...
Event Handling ~ foundjava
Any program that uses GUI (graphical user interface) such as Java application written for windows, is event driven. Event describes the change of state of any object. Example : Pressing a button, Entering a character in Textbox.
Components of Event Handling
Event handling has three main components,
Events : An event is a change of state of an object.
Events Source : Event source is an object that generates an event.
Listeners : A listener is an object that...
Event Handling ~ foundjav
Any program that uses GUI (graphical user interface) such as Java application written for windows, is event driven. Event describes the change of state of any object. Example : Pressing a button, Entering a character in Textbox.
Components of Event Handling
Event handling has three main components,
Events : An event is a change of state of an object.
Events Source : Event source is an object that generates an event.
Listeners : A listener is an object that...
Applet ~ foundjava
Applet in Java
Applets are small Java applications that can be accessed on an Internet server, transported over Internet, and can be automatically installed and run as apart of a web document. Any applet in Java is a class that extends the java.applet.Applet class.
An Applet class does not have any main() method.
It is viewed using JVM. The JVM can use either a plug-in of the Web browser or a separate runtime environment to run an applet application.
JVM creates an instance...
Legacy Classes ~ foundjava
Legacy Classes
Early version of java did not include the Collection framework. It only defined several classes and interface that provide method for storing objects. When Collection framework were added in J2SE 1.2, the original classes were reengineered to support the collection interface. These classes are also known as Legacy classes. All legacy claases and interface were redesign by JDK 5 to support Generics.
The following are the legacy classes defined by java.util package
Dictionary
HashTable
Properties
Stack
Vector
There...
Comparator Interface ~ foundjava
In Java, Comparator interface is used to order the object in your own way. It gives you ability to decide how element are stored within sorted collection and map.
Comparator Interface defines compare() method. This method compare two object and return 0 if two object are equal. It returns a positive value if object1 is greater than object2. Otherwise a negative value is return. The method can throw a ClassCastException if the type of object are not compatible for...
Map Interface ~ foundjava
A Map stores data in key and value association. Both key and values are objects. The key must be unique but the values can be duplicate. Although Maps are a part of Collection Framework, they can not actually be called as collections because of some properties that they posses. However we can obtain a collection-view of maps.
InterfaceDescription
MapMaps unique key to value.
Map.EntryDescribe an element in key and value pair in a map. This is an inner class of map.
NavigableMapExtends...
Iterator and ListIterator ~ foundjava
Accessing a Collection
To access, modify or remove any element from any collection we need to first find the element, for which we have to cycle throught the elements of the collection. There are three possible ways to cycle through the elements of any collection.
Using Iterator interface
Using ListIterator interface
Using for-each loop
Accessing elements using Iterator
Iterator Interface is used to traverse a list in forward direction, enabling you to remove or modify the elements...
Collection Classes ~ foundjava
The Collection classes
Java provides a set of Collection classes that implements Collection interface. Some of these classes provide full implementations that can be used as it is and other abstract classes provides skeletal implementations that can be used as starting points for creating concrete collections.
ArrayList class
ArrayList class extends AbstractList class and implements the List interface.
ArrayList supports dynamic array that can grow as needed....
Collection Interfaces ~ foundjava
Interfaces of Collection Framework
The collection framework has a lot of Interfaces, setting the fundamental nature of various collection classes. Lets study the most important Interfaces in the collection framework.
The Collection Interface
It is at the top of collection heirarchy and must be implemented by any class that defines a collection. Its general declaration is,interface Collection < E >
Following are some of the commonly used methods in this interfa...
Introduction to Collection ~ foundjava
Collection Framework
Collection framework was not part of original Java release. Collections was added to J2SE 1.2. Prior to Java 2, Java provided adhoc classes such as Dictionary, Vector, Stack and Properties to store and manipulate groups of objects. Collection framework provides many important classes and interfaces to collect and organize group of alike objects.
Important Interfaces of Collection API
InterfaceDescription
CollectionEnables you to work with groups of object;...
Subscribe to:
Posts (Atom)