Computer Science, asked by asmitpanda11, 11 months ago

Give the output of the following code:
String P="20", Q="19";
int a = Integer.parseInt(P);
int b = Integer.valueOf(Q);
System.out.println(a+""+b);

Answers

Answered by anupama777vidya
39

Answer:

20 19

Explanation:

Both functions convert the given string to an integer.

But valueOf() returns a new integer object and parseInt() returns a primitive integer.

Hope it helps you

Answered by StaceeLichtenstein
12

2019 is the output of the given question

Explanation:

Following are the description of the output of the given program.

  • In this Program the String P and Q is initialized with 20 and 19 respectively.
  • After that we convert that into the integer by using the "Integer.parseInt" function .This will convert into the integer value .So String "P" and 'Q" is converted into the integer value in variable "a" and "b" respectively.
  • Finally these value are printed into the console and 2019 is printed on the screen.

Learn More:

  • brainly.in/question/14887111
Similar questions