Venkata Sai has Published 62 Articles

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

Venkata Sai

Venkata Sai

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

631 Views

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

3K+ Views

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

2K+ Views

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

1K+ Views

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

81 Views

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

Are true and false keywords in java?

Venkata Sai

Venkata Sai

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

831 Views

Keywords − Keywords in Java convey a special meaning to the compiler therefore, these cannot be used as identifiers. Java provides a set of 50 keywords.abstractcontinuefornewswitchassertdefaultgotopackagesynchronizedbooleandoifprivatethisbreakdoubleimplementsprotectedthrowbyteelseimportpublicthrowscaseenuminstanceofreturntransientcatchextendsintshorttrycharfinalinterfacestaticvoidclassfinallylongstrictfpvolatileconstfloatnativesuperwhileReserved words − Among the list of key words list mentioned above the key words goto and const are currently not in use. They are ... Read More

Differentiate between the prefix and postfix forms of the ++ operator in java?

Venkata Sai

Venkata Sai

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

3K+ Views

Java provides two operators namely ++ and --, to increment and decrement values by 1 respectively.There are two variants of these operators −Pre-increment/decrement − This form, increments/decrements the value first, and then performs the specified operation.ExampleIn the following example, the initial value of the variable i is 5. We are ... Read More

What are the restrictions on increment and decrement operators in java?

Venkata Sai

Venkata Sai

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

1K+ Views

The increment operator increments the value of the operand by 1 and the decrement operator decrements the value of the operand by 1. We use these operators to increment or, decrement the values of the loop after executing the statements on a value.Example Live Demopublic class ForLoopExample {    public static ... Read More

Can a for statement loop infinitely in java?

Venkata Sai

Venkata Sai

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

2K+ Views

Using loops in programming languages we can execute a set of statements repeatedly. Java provides various loops namely while loop, for loop and the do while loop.The for statement contains an initialization statement, a condition and, an increment or decrement operation.Initializing statement − The initialization determines the starting value of ... Read More

What is shallow copy? Explain with an example in Java.

Venkata Sai

Venkata Sai

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

785 Views

Creating an exact copy of an existing object in the memory is known as cloning.The clone() method of the class java.lang.Object accepts an object as a parameter, creates and returns a copy of it (clones).In order to use this method, you need to make sure that your class implements the ... Read More

Advertisements