Maruthi Krishna has Published 952 Articles

When does a Java Array Throws a NullPointerException?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:40:03

3K+ Views

In Java there is default value for every type, when you don’t initialize the instance variables of a class Java compiler initializes them on your be-half with these values. Null is the default value of the object type, you can also manually assign null to objects in a method.Object obj ... Read More

What are try, catch, finally blocks in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:35:00

2K+ Views

An exception is an issue (run time error) occurred during the execution of a program. For understanding purpose let us look at it in a different manner.Generally, when you compile a program, if it gets compiled without a .class file will be created, this is the executable file in Java, ... Read More

What is the cause of NoSuchElementException and how can we fix it in java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:33:06

1K+ Views

What is the cause of NoSuchElementException and how can we fix it in java?An exception is an issue (run time error) occurred during the execution of a program. When an exception occurred the program gets terminated abruptly and, the code past the line that generated the exception never gets executed. ... Read More

How to handle MalformedURLException in java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:31:32

1K+ Views

While working with client-server programming in Java (JSE), if you are using java.net.URL class object in your program, you need to instantiate this class by passing a string representing required URL to which you need to establish connection. If the url you have passed in the string which cannot be ... Read More

Why variables defined in try cannot be used in catch or finally in java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:30:03

5K+ Views

A class in Java will have three kinds of variables namely, static (class), instance and, local.Instance variables − These variables belong to the instances (objects) of a class. These are declared within a class but outside methods. These are initialized when the class is instantiated. They can be accessed from ... Read More

Do all properties of an Immutable Object need to be final in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:29:20

828 Views

Immutable class/object is the one whose value cannot be modified. For example, Strings are immutable in Java i.e. once you create a String value in Java you cannot modify it. Even if you try to modify, an intermediate String is created with the modified value and is assigned to the ... Read More

What happens if an exception is not handled in a java program?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:28:11

3K+ Views

An exception is an issue (run time error) occurred during the execution of a program. For understanding purpose let us look at it in a different manner.Generally, when you compile a program, if it gets compiled without a .class file will be created, this is the executable file in Java, ... Read More

What is a MalformedURLException and how to fix it in java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:26:42

16K+ Views

While working with client-server programming in Java (JSE), if you are using java.net.URL class object in your program, you need to instantiate this class by passing a string representing required URL to which you need to establish connection. If the url you have passed in the string which cannot be ... Read More

What are the modifiers allowed to use along with local variables in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:24:08

930 Views

In Java you can declare three types of variables namely, instance variables, static variables and, local variables.Local variables − Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and the variable will be destroyed when the method has ... Read More

What is blank final variable? What are Static blank final variables in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Jul-2020 14:19:27

2K+ Views

Static variables − Static variables are also known as class variables. You can declare a variable static using the keyword. Once you declare a variable static there would only be one copy of it in the class, regardless of how many objects are created from it.public static int num = ... Read More

Advertisements