There's an error in my code on the last line of functioning code.
package Class;
import java.util.Scanner;
public class Bicycle
{
public int units;
public int courseNum;
public String courseName;
public Bicycle(int startUnits, int startNum, String startName)
{
units = startUnits;
courseNum = startNum;
courseName = startName;
}
public int setUnits(int newValue)
{
units = newValue;
return units;
}
public int setNum(int newValue)
{
courseNum = newValue;
return courseNum;
}
public String setName(String newValue)
{
courseName = newValue;
return courseName;
}
public class subClass extends Bicycle
{
public int randVariable;
public subClass(int startUnits, int startNum, String startName)
{
super(startUnits, startNum, startName);
}
public void randVariable(int newValue)
{
randVariable = newValue;
}
}
public static void main(String args[])
{
int BaseUnits;
int BaseCourseNum;
String BaseCourseName;
int FinalUnits;
int FinalcourseNum;
String FinalcourseName;
Scanner entries = new Scanner(System.in);
BaseUnits = entries.nextInt();
BaseCourseNum = entries.nextInt();
BaseCourseName = entries.nextLine();
FinalUnits = setUnits(BaseUnits);
}
}
The error states that I cannot reference a non-static method from a static context.
So I then proceeded to look up questions on Stack about static and non-static methods, but the answers were all pretty confusing - possibly due to the fact that I am a beginner in programming.