I want to make a sum of two numbers in Java between two classes by calling the second constructor with this(). But I have problems doing that. How can I do it? CLASS A public class A { } CLASS B public class B { }
Added by Melissa L.
Close
Step 1
num1 = num1; this.num2 = num2; } } ``` Show more…
Show all steps
Your feedback will help us improve your experience
Hannah Wilds and 55 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Create a class called Pair that has two public integer member variables named "a" and "b", and a public member function named sum() that has no arguments but adds the two member variables together and returns their sum.
Michael F.
write a java program to accept two integers as command line arguments and print the sum of the two numbers
Willis J.
Assign and print the roll number, phone number and address of two students having names "Sam" and "John" respectively by creating two objects of class 'Student'. (java)
Madhur L.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD