Raja has Published 760 Articles

What is a Type-safe Enum in Java?

raja

raja

Updated on 23-Nov-2023 10:34:48

913 Views

The enums are type-safe means that an enum has its own namespace, we can’t assign any other value other than specified in enum constants. Typesafe enums are introduced in Java 1.5 Version. Additionally, an enum is a reference type, which means that it behaves more like a class or an interface. ... Read More

Importance of isDaemon() method in Java?

raja

raja

Updated on 23-Nov-2023 10:29:10

347 Views

A daemon thread is a low-priority thread in java which runs in the background and mostly created by JVM for performing background tasks like Garbage Collection(GC). If no user thread is running then JVM can exit even if daemon threads are running. The only purpose of a daemon thread is to ... Read More

How to check if a given character is a number/letter in Java?

raja

raja

Updated on 23-Nov-2023 10:24:03

40K+ Views

The Character class is a subclass of Object class and it wraps a value of the primitive type char in an object. An object of type Character contains a single field whose type is char. We can check whether the given character in a string is a number/letter by using isDigit() ... Read More

How to create a thread by using anonymous class in Java?

raja

raja

Updated on 23-Nov-2023 10:17:47

2K+ Views

A Thread is a functionality which can be executed simultaneously with the other part of the program. All Java programs have at least one thread, known as the main thread, which is created by the Java Virtual Machine (JVM) at the program start when the main() method is invoked with ... Read More

Importance of deepToString() and asList() methods in Java?

raja

raja

Updated on 23-Nov-2023 10:13:54

198 Views

An array is an object that holds a fixed number of values of a single type in a contiguous memory location. Both deepToString() and asList() methods are static methods of Arrays class. The deepToString() method converts multi-dimensional array to string and it checks if an array has the element as ... Read More

How to find the number of days in a month of a particular year in Java?

raja

raja

Updated on 23-Nov-2023 10:08:36

891 Views

A GregorianCalendar is a concrete subclass of Calendar class and it provides the standard calendar system used by most of the world. In Java, this GregorianCalendar can handle both the Gregorian calendar as well as Julian calendar. We can determine or find the number of days in a month of a ... Read More

When to use fillInStackTrace() method in Java?

raja

raja

Updated on 23-Nov-2023 09:28:44

1K+ Views

The fillInStackTrace() is an important method of Throwable class in Java. The stack trace can be useful to determine where exactly the exception is thrown. There may be some situations where we need to rethrow an exception and find out where it is rethrown, we can use the fillInStackTrace() method ... Read More

Importance of StringReader class in Java?

raja

raja

Updated on 23-Nov-2023 09:13:26

157 Views

The StringReader class is s subclass of a Reader class and it can be used to read the character stream in the form of a string which acts as a source to StringReader. The StringReader class overrides all the methods from a Reader class. The important methods of StringReader class ... Read More

How many ways to make an object eligible for GC in Java?

raja

raja

Updated on 23-Nov-2023 09:07:55

276 Views

The process of destroying unreferenced objects is called a Garbage Collection(GC). Once an object is unreferenced it is considered as an unused object, hence JVM automatically destroys that object. There are various ways to make an object eligible for GC. By nullifying a reference to an object We can set all the available ... Read More

When can we call wait() and wait(long) methods of a Thread in Java?

raja

raja

Updated on 22-Nov-2023 12:46:34

464 Views

Whenever the wait() method is called on an object, it causes the current thread to wait until another thread invokes the notify() or notifyAll() method for this object whereas wait(long timeout) causes the current thread to wait until either another thread invokes the notify() or notifyAll() methods for this object, ... Read More

Previous 1 ... 4 5 6 7 8 ... 76 Next
Advertisements