Explain the origin and the use of .class file in Java Programming.
Requirements: See attached file
Question One
Explain the origin and the use of .class file in Java Programming.
Question Two
Write a program that takes the birth year from the user and prints her/his age. Here are sample runs of the program:
Sample 1:
Enter your birth year: 1981
Your Age is: 42 years
Sample 2:
Enter your birth year: 2000
Your Age is: 23 years
Question Three
What is the output of each of the following? (Note: if there is an error, you must specify the type of the error: syntax error or runtime error or logic error)
a) (0.5 marks)
double a = 5;
double b = 2;
System.out.println(a+b);
b) (0.5 marks)
String a = “5”;
String b = “2”;
System.out.println(a+b);
c) (0.5 marks)
int a = “5”;
int b = “2”;
System.out.println(a+b);
d) (0.5 marks)
int a = 5;
int b = 0;
System.out.println(a/b);
e) (0.5 marks)
int a = 5;
int b = 2;
System.out.println(a%b);
f) (0.5 marks)
int a = 5;
int b = a++;
b +=5;
System.out.println(b++);
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
