Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Could you help me find all the syntax errors with this javaprogram? It\'s a 2 pa

ID: 3608907 • Letter: C

Question

Could you help me find all the syntax errors with this javaprogram? It's a 2 part question, A & B. I just feel its a trickquestion because all I see wrong is missing semi-colons! A.
public class AA { private int x;
private int y;
public void print ( )
{
System.out.println(x + " " + Y);
}
public int sum ( )
{
return x + y;
}
public AA ( )
{
x = 0;
y = 0;
}
public int AA(int a, int b)
{
x = a;
y = b;
}
}
B.
public class BB { private int one;
private int two;

public boolean equal ( )
{
return (one == two);
}

public print ( )
{
System.out.println(one + " " + two);
}
public BB(int a, int b)
{
> two = b;
}
}
A.
public class AA { private int x;
private int y;
public void print ( )
{
System.out.println(x + " " + Y);
}
public int sum ( )
{
return x + y;
}
public AA ( )
{
x = 0;
y = 0;
}
public int AA(int a, int b)
{
x = a;
y = b;
}
}
B.
public class BB { private int one;
private int two;

public boolean equal ( )
{
return (one == two);
}

public print ( )
{
System.out.println(one + " " + two);
}
public BB(int a, int b)
{
> two = b;
}
}

Explanation / Answer

public class AA { private int x;
private int y;
public void print ( )
{
//System.out.println(x + " " +Y);
System.out.println(x + " " + y);
}
public int sum ( )
{
return x + y;
}
public AA ( )
{
x = 0;
y = 0;
}
//public int AA(int a, intb)       constructor have not returntype
public AA(int a, int b)
{
x = a;
y = b;
}
}
B.
public class BB { private int one;
private int two;

public boolean equal ( )
{
return (one == two);
}

//public print ()       method must have returntype
public void print()
{
System.out.println(one + " " + two);
}
public BB(int a, int b)
{
> two = b;
}
}
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote