Please help me to solve this | Sololearn: Learn to code for FREE!

+6

Please help me to solve this

public class Hello { public static void main(String[]args){ b = ++ b - a; a + = (b -a ); sum = a + b; System.out.println(sum); }} Use the above code to answer questions 8-10. 8.what is the value of b? 9.what is the value of a; 10. What is the value of sum?

8/7/2022 5:12:56 PM

Mohammed Bukar

14 Answers

New Answer

+4

What are your observations? Jumping into using variables before declaring it..? No values assinged? How the values come out?

+1

System.out.println("a= " + a + " b= " + b) ; Add this to your code at end..

+1

Thank you all

+1

You didn't take input from user Use scanner

+1

Hi Bukar, what do you try to say? And what about your intention! Thanks 😊

0

I'll be waiting for your answer.

0

I'm sorry. It should be. static int a =1, b = 0, sum = 2;

0

Mohammed Bukar have you tried running the code? You'll get an answer much quicker than waiting for the Sololearn Community to take your test for you.

0

Mohammed Bukar Add that to your code and check output.. Then say your understandings.. and doubts here if any!!!!

0

I run it , but I want to see the value of a & b; Pls

0

Put a and b into the println statement.

0

And another question is : list and explain the three basis principles of OOP?

0

List and explain the three basis principles of OOP https://googlethatforyou.com?q=list%20and%20explain%20the%20three%20basis%20principles%20of%20OOP%3F

0

B = ++ b- a and A= (b- a Sum = a+ B Thank you