ITSourceCode.com

Free Source Code and Tutorials

Custom Search

Category: Java Tutorial

Java Regular Expression

Java provides the java.util.regex package for pattern matching with regular expressions. A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. They can be used to search, edit, or manipulate text and data. The java.util.regex package […]

Share this

Object class in Java

The Object class is the parent/base class of all the classes in java by default. An object class can be used in upcasting. If you don’t know the type of any object we can use Object class to refer that object. Let’s take an example, there is getObject() method that returns an object but it […]

Share this

How to get current date and time of the system in Java ?

In Java we have Date class available in java.util package which encapsulates the current date and time. The Date class have two constructors mentioned below: 1 Date( ) This constructor initializes the object with the current date and time. This doesn’t require any argument. 2 Date(long millisec) We need to provide an argument to this constructor that […]

Share this

Encapsulation

Encapsulation In Java data encapsulation is concerned with: Combining data and how it’s manipulated in one place. Only allowing the state of an object to be accessed and modified through behaviors. Hiding the details of how the object works. Example: < View plain text > java public class Vegetable {   private String name; private […]

Share this

Abstraction

Abstraction Abstraction in Java is used to hide certain details and only show the essential features of the object. In other words, it deals with the outside view of an object (interface). An abstract class contains an abstract keyword. An abstract class can or cannot have abstract methods. A method that is declared as abstract […]

Share this

Polymorphism

Polymorphism The word ‘polymorphism’ literally means ‘the capacity to take on different forms’. When applied to object oriented programming language like Java, it describes a language’s ability to process objects of various types and classes through a single interface. Example: < View plain text > java public interface Small{} public class House{} public class Room […]

Share this

Overriding

Overriding If the child class has the same method as the parent class we call it method overriding in java. Example: < View plain text > java class House { void display() { System.out.println(“House”); } }   class Room extends House { void display() { System.out.println(“Room”); } }   class Basic {   public static […]

Share this

Inheritance

INHERITANCE Inheritance is one of the key features of Java. Inheritance basic use is that it allows a class to inherit property of another class. When a Class extends another class it inherits all non-private members including fields and methods. Inheritance in Java is usually understood in terms of Parent and Child relationship, also known […]

Share this

Inner Classes

Java Inner Class Java inner class can be called as nested class i.e. declared inside the class or interface. We use inner classes to group classes and interfaces in one place so that it can be more readable,understandable and maintainable. It also allows access to all the members of outer class including even private data […]

Share this

Exception

Exception Handling in Java The exception handling in java is a mechanism to handle the runtime errors, that occurs a lot for a beginner, so that actual programme of the application can be maintained. We will learn about java exception, its type and the basic difference between checked and unchecked exceptions. Exception? In java, exception […]

Share this
Page 1 of 41234
ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!