Venkata Sai has Published 72 Answers

What are the restrictions placed on method overloading in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

When a class has two or more methods by the same name but different parameters, at the time of calling based on the parameters passed respective method is called (or respective method body will be bonded with the calling line dynamically). This mechanism is known as method overloading.Example Live Democlass Test{ ... Read More

Can we overload a method based on different return type but same argument type and number, in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

When a class has two or more methods by the same name but different parameters, at the time of calling based on the parameters passed respective method is called (or respective method body will be bonded with the calling line dynamically). This mechanism is known as method overloading.Exampleclass Test{ ... Read More

What value does read() method return when it reaches the end of a file in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

The read() method of the input stream classes reads the contents of the given file byte by byte and returns the ASCII value of the read byte in integer form. While reading the file if it reaches the end of the file this method returns -1.ExampleAssume we have a text ... Read More

What are the rules on method overriding in Java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

If superclass and subclass have methods with same name including parameters. JVM calls the respective method based on the object used to call the method.i.e. if the object used to call the method is of superclass type the method of the superclass is executed.Or, if the object is of the ... Read More

What is EOFException in Java? How do we handle it?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

While reading the contents of a file in certain scenarios the end of the file will be reached in such scenarios a EOFException is thrown.Especially, this exception is thrown while reading data using the Input stream objects. In other scenarios a specific value will be thrown when the end of ... Read More

Can you cast a Byte object to a double value in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

Java provides various datatypes to store various data values. It provides 7 primitive datatypes (stores single values) namely, boolean, byte, char, short, int, long, float, double and, reference datatypes (arrays and objects).Casting in JavaConverting one primitive data type into another is known as type casting. There are two types of ... Read More

Can we cast a double value to a byte in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

Java provides various datatypes to store various data values. It provides 7 primitive datatypes (stores single values) namely, boolean, byte, char, short, int, long, float, double and, reference datatypes (arrays and objects).Casting in JavaConverting one primitive data type into another is known as type casting. There are two types of ... Read More

How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

In general, data is stored in a computer in the form of bits (1 or, 0). There are various coding schemes available specifying the set of bytes represented by each character.ASCII − Stands for American Standards Code for Information Interchange. It is developed by American standards association and is the ... Read More

What are the rules to be followed while working with a switch statement in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each case.Syntaxswitch(expression) {    case value :       // Statements       break;    case value ... Read More

Elaborate the legal operands of the instance of operator in java?

Venkata Sai

Venkata Sai

Updated on 30-Jul-2019 22:30:26

The instanceof operator in Java is used to find whether a reference is an instance of a Type i.e. class or an interface.Example Live Demopublic class InstanceOfExample {    public static void main(String args[]) {       String str = "hello";       boolean bool = str instanceof String; ... Read More

Advertisements