Ask Question

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

+2
Answers (1)
  1. 1 October, 03:56
    0
    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
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Explain TWO (2) differences between int and Integer in the context of Java programming using suitable example, ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers