Question #274954

Compare and use various data types in a java program, declare and use constant and variables and cast and value of one data type to another data type. Write a java program that initialize the following:



"Data Type"


double


short


double


int




"Variable Name"


size


grade


final_grade


final_length




"Value"


125.83d


87


grade


side




Name the class as Data and save the file. Debug syntax and logical errors if there is any in the program. Save the file.




Expert's answer

public class Demo {
 public static void main(String[]args) {
  double size = 125.83d;
  short grade = 87;
  double final_grade = (double) grade;
  int final_size = (int) size;
 }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS