I'm currently taking a course in Java in college. I want to know if
anyone can help me out how to overload a constructor without
declaring any private variables. I know that the method name is the
same as the class.
Here is the code:
public class john{
public static void main(String args[]){
int num1=4;
int num2=4;
System.out.println("The numbers are "+num1+" and "+num2);
jmav frisky=new jmav(3,3);
frisky.send(num1,num2);}}
public class jmav{
jmav(int n1,int n2){
num1=n1;
num2=n2;}
public static void send(int n1,int n2){
System.out.println("The numbers are "+n1+" and "+n2);}}
Something was not right when the compiler generated errors when
javacing john.java. Can anyone solve that problem for me? What could
be the correct code for overloading a constructor and send it to
another class?