elian2052 elian2052
  • 04-10-2019
  • Computers and Technology
contestada

Explain TWO (2) differences between int and Integer in the context of Java programming using suitable example,

Respuesta :

klekaelly
klekaelly klekaelly
  • 04-10-2019

Answer:

Int is primitive, integer is an object

Explanation:

int i = 6;

vs

Integer i = new Integer(6);

Two different ways of initiation. Also, you can't call any methods onto the int because it is primitive. See here:

String s = i.toString();   // This will not work

Answer Link

Otras preguntas

__________ are best for exhaustive searching for particular data like names, terms, and text. a. Search engines b. Databases c. Directories X d. Online reso
Which of the following statements is true? a. Money is a medium of exchange. c. Money serves as a store of value. b. Money is a unit of account. d. all of the a
round each decimal to the nearest whole number 30.92
What is the slope and y-intercept of this line? y = –3x + 9 A. slope: 3, y-intercept: –9 B. slope: –3, y-intercept: 9 C. slope: 1, y-intercept: –3 D. slope: 9,
Which queen was a great patron of William Shakespeare’s works?
What did the Dutch name their settlement located on Manhattan Island?
what is mother teresa's marital status
All of the following European countries held territory in Africa EXCEPT: A. Belgium B. Russia C. France D. England
How do you Graph 0=x+1/4y+1/2
write a sentence that mentions a foreign country or sport and an athlete