Name the 8 primitive types in Java. Write code that will declare an int called n
ID: 3788542 • Letter: N
Question
Name the 8 primitive types in Java. Write code that will declare an int called n and set its value to 97. Suppose that you have a String named p. Write a line of code that will define an int variable called y and set the value of y to the length of p. Literal strings use codes for certain things which start with a backslash For example "n" indicates a newline character. What are the codes for the following? Write a single line of code using system.out.println that will print the ints x, y, and z on the same line with semicolons Name 6 functions in the Math class. Write a complete Java program in a class called PrintStats that prints your name and major.Explanation / Answer
1.Ans:
boolean ,byte,char,short,int,long,float,double
===================================================================================
2.
class test
{
public static void main(String[] args) {
int n=97;
}
}
===================================================================================
3.
class test
{
public static void main(String[] args) {
String p="akshay";
int y=p.length();
}
}
===================================================================================
4. tab=" "
quotation mark=""""
Backslash: "\"
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.