Which one of the following variables is assigned with valid literals?
a) int salary = 0;
salary = 5000.50;
b) int salary1 = 0;
salary1 = 1.2E6;
c) double salary2 = 0;
salary2 = 2.96E-2;
d) long salary3 = 0;
salary3 = 1E-6;



Answer :

C) double salary2 equals 0; pay2 is 2.96E-2; It is not possible to use the reserved words int, static, void, and so on as variable names.

Which of the following is a valid name for a variable?

Some examples of valid variable names are as follows: age, gender, age_of_hh_head, and x25 A valid variable name begins with a letter and can be followed by underscores, digits, or letters. The value that the namelengthmax command returns is the maximum length of a variable's name.

In Java, which of the following is correct for declaring and initializing a variable?

A variable is declared (created) by specifying its type, leaving at least one space, giving it a name, and concluding the line with a semicolon (;). The keyword int denotes an integer, the keyword double denotes a floating point number with double precision, and the keyword boolean denotes a Boolean value in Java.

To learn more about variable's here:

https://brainly.com/question/15740935

#SPJ4

Other Questions