Q1) By convention, variable names in Java use camel case. Describe what this is
ID: 3874048 • Letter: Q
Question
Q1) By convention, variable names in Java use camel case. Describe what this is 02) What is the difference between the style for a class name and a variable name in Java? Q3) What is the standard indentation style for curly braces in Java? 04) Why is proper indentation important in Java code? Q5) What is the common way to specify a constant value in Java? 06) What unnamed constants are usually acceptable in a Java program? Q7) Which of the bits of code below follow the coding standards? Write the letters of the expressions that follow the coding standards on your answer sheet a) int a; b) in A c) public class FunClass d) public static final int my const-3 e) public int myFunction int n) public boolean MyBooleanFunction boolean b) Java Arithmetic The result of a mathematical expression in Java depends on the operation performed, such asJ, as well as the type of operand it operates on, such as int or produces an int type. Them d operator, indicated by the percent sign% gives there under ofan integer division. Operations that involve mixed types, such as an int and a double proceed by converting the narrower type (int) to the wider type (double). The result is always the wider type. Literals also have a type. If a number is written as an integer it will be given the type of int, and if a number is written with a decimal point it will be given the type of double double. For example, division of an int by another int always 08) If b is of type int, and e is of type double, what are the types of the following espressions? Write the types of the expressions on your answer sheet. b%3 b. b+4 C.b2.0 e. b+eExplanation / Answer
Q1. Camel Case - Java uses CamelCase for the purpose of naming variables, classes, methods etc. Its been formed by using the capital letter as the firstletter in each word, so that it can able to read it very comfortably. Example: ComputerHope which is refered as Camel Caps.
Q2. Variable name
Class name
Q3. Curly braces style indentation
Q4. importance of proper indentation in java
Q5. constant value in java
int number_of_days = 365;
this statement can be used for specifying a constant value of the variable throught the program.
Q6. unnamed constant in java
text and numeric. Because, like variables they do not have any specific names. They are just remain constant and it does not change.
Q7.
a) int a - correct
b) int A = wrong format
c) public class FunClass - correct format
d) public static final int my_const = 3; - correct format
e) public int myFunction(int) - wrong format
f) public boolean MyBooleanFunction(boolean b) - wrong format
Q8.
a) b % 3 - int, because b is of type int
b) b + 4 - int, because b is of type int
c) b * 2.0 - double, because b is double
d) c / 2 - double, because c is double
e) b + c - double, because double holds the larger data type
Q11)
static variable
non-static variable
Q12)
import java.util.*;
import java.lang.*;
import java.io.*;
public class Car
{
public static void main (String[] args)
{
int totalCrsManufactured;
Static int carModel = 2017;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.