I suggest looking at how to define classes.
public class Box
{
// your class definition goes here
// this is a field
private int fitsHowManyCoffees;
// this is a constructor
public Box(int fitsHowManyCoffees)
{
this.fitsHowManyCoffees = fitsHowManyCoffees;
}
// this is a method
public int getFitsHowMany()
{
return fitsHowManyCoffees;
}
}
public class User
{
public static void main(String[] args)
{
// this creates a new box which can hold 3 coffees
Box holds3 = new Box(3);
System.out.println("the box holds " + holds3.getFitsHowMany() + " coffees.");
}
}