Q What is the output of the following code Part A int num1

Q. What is the output of the following code:

Part A.

int num1 = 6;

int num2 = 10;

num1 = num1 + num2;

num2 = num1 + num2;

System.out.println(num1 + \", \" + num2);

Part B.

int a = 10;

int b = 20;

int c = 2;

int x = b / a /*c*/;

Solution

part a:

class Chegg
{
public static void main(String args[])
{
int num1 = 6;
int num2 = 10;
num1 = num1 + num2; //num1=6+10
num2 = num1 + num2; // num2=16+10
System.out.println(num1 + \", \" + num2);
}
}

output is: 16,26

part b:

class Chegg
{
public static void main(String args[])
{
int a = 10;
int b = 20;
int c = 2;
int x = b / a /*c*/; //x=20/10/*2*/ =>20/10/1=>2
System.out.println(x);
}
}

output: 2

Q. What is the output of the following code: Part A. int num1 = 6; int num2 = 10; num1 = num1 + num2; num2 = num1 + num2; System.out.println(num1 + \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site