1. Assign the suitable data type for the following values.
a) 130
b) false
c) “DataTypes”
d) ‘d’
e) 15.50
f) 6.03165491
2. Distinguish between primitive and non-primitive data types.
Programs:
1. Write a program in Java to take 3 input values from user (run-time) and calculate and display the average of those no’s.
(Hint: (a+b+c)/3)
2. Write a program in Java to calculate the simple interest. Value of principal, rate and time should be entered by user run-time.
(Hint: (p*r*t)/100)
3. Write a program in Java to calculate area of square.
(Hint: area= side*side)
Answers
Answered by
2
Answer:
The main difference between primitive and non-primitive data types are: Primitive types are predefined (already defined) in Java. Non-primitive types are created by the programmer and is not defined by Java (except for String ). ... A primitive type has always a value, while non-primitive types can be null
Similar questions