Java General

Java Marker interfaces

Following table gives all the list of Java Marker interfaces. Maker interface name Functionality 1. java.io.Serializable the object is serialized 2. java.lang.Cloneable the object is cloned 3. javax.servlet.SingleThreadModel only one object of the servlet for one request is created 4. javax.ejb.EnterpriseBean the object can participate in transactions 5. java.util.RandomAccess the…

What is Marker Interface in Java?

1. What is marker interface? By usage, a marker interface does not contain any methods or variables. It is completely empty interface and for this reason also known as empty interface. See these two marker interface definitions in Java API. java.lang.Cloneable and java.io.Serializable are two marker interfaces often used. See…

Object Casting Problems Java

Object Casting Problems Java

Every language comes with data type casting and in Java, also exist object casting. For a novice, it is very confusing. Let us discuss different variations of Object Casting Problems. Before going though this, if you are not aware, it is advised to read Object Casting. Java supports object casting…

Why Java does not support Multiple Inheritance?

Java does not support Multiple Inheritance: Java designer, Mr.James Gosling, committed to keep Java very simple to practice even for novices; infact, it is one of goals and features of Java language. Towards this goal, he avoided multiple inheritance, operator overloading, pointers and prototype declaration etc. which adds unnecessary problems…

Why Java does not support operator overloading?

Java does not support operator overloading: Java is relatively a very simple language to use compared C/C++ with the non-support of complex and confusing features like pointers, multiple inheritance and operator overloading. These features are rarely used in practice and at the same time poorly understood by the language beginners.…

Differences between StreamTokenizer and StringTokenizer in Java

Breaking the data into independent pieces is known as tokenization. For example, breaking a sentence into different words is known as tokenization. To do the job, Java comes with two tokenizers – StringTokenizer to tokenize a string and StreamTokenizer to tokenize a stream of data coming from I/O stream classes.…

Instantiate Java

In Java, object creation is known as instantiation because an instance of a class is object. Let us explain more through Instantiate Java.

In the above code, d1 is known as object of Demo class. Other way, we can say, d1 object is instantiated. In my own way, I…

Java Coding

Java coding is simple to practice. First reason, I give is Java does not support pointers. Due to many predefined methods available, with less code and in less time, you can do your task. For this reason, Java is known as "Production Language" . I give simple Java coding example…

Java newInstance

With Java newInstacnce() of class Class, we can create an object as you will do with new keyword. Example on Java newInstance

Output screenshot on Java newInstance Example The newInstance() method of java.lang.Class returns an object of class Object represented by a Class object. It is very confusing. Let…

Java getClass

There exists a class by name Class in Java, like you know, Double class and double. The object of class Class contain runtime representation of a class. Java getClass () method is used to know a class’s super classes and interfaces, its name etc. Following code explains. Following is the…

Classes Objects Java

Classes Objects Java tutorial explains creation of objects, writing classes, methods, variables etc. for a Beginner Java Classes To write the code in Java, a class is required. It is the basic construct for a Java program. Following denotes class by name Demo.

The name of the class is…

Java Parse String to Date

Sometimes, it is also needed to convert String to Date; we have seen earlier how to convert Date to String. Now Parse String to Date is done. Following code gets you the conversion of string to date. We use SimpleDateFormat class method parse(). Example on Parse String to Date