Maruthi Krishna has Published 951 Articles

How to check if an URL is valid or not using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Sep-2019 07:30:14

2K+ Views

The URL class of the java.net package represents a Uniform Resource Locator which is used to point a resource(file or, directory or a reference) in the worldwide web.This class provides various constructors one of them accepts a String parameter and constructs an object of the URL class. While passing URL ... Read More

Are Generics applied at compile time or run time?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Sep-2019 07:17:53

467 Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class ... Read More

Is it possible to instantiate Type-parameter in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 09-Sep-2019 07:14:13

4K+ Views

Generics is a concept in Java where you can enable a class, interface and, method, accept all (reference) types as parameters. In other words it is the concept which enables the users to choose the reference type that a method, constructor of a class accepts, dynamically. By defining a class ... Read More

The readUTF() and writeUTF() methods in Java

Maruthi Krishna

Maruthi Krishna

Updated on 06-Sep-2019 14:10:39

3K+ Views

Unicode (UTF) − Stands for Unicode Translation Format. It is developed by The Unicode Consortium. if you want to create documents that use characters from multiple character sets, you will be able to do so using the single Unicode character encodings. It provides 3 types of encodings.UTF-8 − It comes ... Read More

How to access the fields of an interface in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 06-Sep-2019 14:04:49

12K+ Views

An interface in Java is a specification of method prototypes. Whenever you need to guide the programmer or, make a contract specifying how the methods and fields of a type should be you can define an interface. By default, All the members (methods and fields) of an interface are public.All ... Read More

How many ways are there to initialize the instance variables of a class in java?

Maruthi Krishna

Maruthi Krishna

Updated on 06-Sep-2019 14:01:45

3K+ Views

You can initialize the instance variables of a class using final methods, constructors or, Instance initialization blocks.Final methodsWhenever you make a method final, you cannot override it. i.e. you cannot provide implementation to the superclass’s final method from the subclass.i.e. The purpose of making a method final is to prevent ... Read More

Util.Arrays and Reflect.Array in Java

Maruthi Krishna

Maruthi Krishna

Updated on 06-Sep-2019 13:57:13

68 Views

The util.Arrays classThe java.util.Arrays class contains a static factory that allows arrays to be viewed as lists. Following are the important points about Arrays −This class contains various methods for manipulating arrays (such as sorting and searching).The methods in this class throw a NullPointerException if the specified array reference is ... Read More

Reflect Array class in Java

Maruthi Krishna

Maruthi Krishna

Updated on 06-Sep-2019 13:53:15

57 Views

The Array class of the java.lang.reflect package provides static methods to create and access Java arrays dynamically. Array permits widening conversions to occur during a get or set operation but throws an IllegalArgumentException if a narrowing conversion would occur.This class provides the newInstance() method, getter method, and setter methods. The ... Read More

Non static blocks in Java.

Maruthi Krishna

Maruthi Krishna

Updated on 06-Sep-2019 13:49:55

3K+ Views

A static block is a block of code with a static keyword. In general, these are used to initialize the static members. JVM executes static blocks before the main method at the time of class loading.Example Live Demopublic class MyClass {    static{       System.out.println("Hello this is a static ... Read More

Assigning arrays in Java.

Maruthi Krishna

Maruthi Krishna

Updated on 06-Sep-2019 13:03:58

7K+ Views

While creating variables first of all we will declare them, initialize them, assign/re-assign values to them.Similarly, while creating arrays −You can declare an array just like a variable −int myArray[];You can create an array just like an object using the new keyword −myArray = new int[5];You can initialize the array ... Read More

Advertisements