Код: Выделить всё
package com.vedantkakade;
class Student {
String fname;
String lname;
public void printInfo() {
System.out.println(fname + " " + lname);
}
Student(Student other) {
this.fname = other.fname;
this.lname = other.lname;
}
}
public class temp {
public static void main(String[] args) {
Student s1 = new Student(); //Error: constructor Student in class com.vedantkakade.Student cannot be applied to given types;
Student s2 = new Student(s1);
}
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... onstructor