Object-Oriented Overview


Here is the code inside the document shown as an example at the start of OOP.

public class Mouse extends Rodentia {

String name;

public Mouse(String name) {

	this.name = name;


public void eat() {

	System.out.println(name + " ate some cheese pizza!");


public void solveMaze(int minutes) {

	System.out.println(name + " solved the maze in " + minutes + " minutes!");


public static void main(String[] args) {

	Mouse ratly = new Mouse("Ratly");



And in a new class//

  public class Rodentia {

 public static void main(String[] args) {


 public void order() {

	System.out.println("This animal belongs to the Rodentia order.");



So my question is, How the heck did ratly get changed into the string Name? It didnt tell the program that name = ratly or Mouse Ratly = name;


Same with this,

public void solveMaze(int minutes)

How does minutes = solveMaze now? I always find it hard wrapping my head around OOP, if you guys could possibly give me a hand that would be great!


I would actually suggest finding a tutorial, online lecture or reading a book about it if you really want to learn. The Java course tells you how to write the absolute basics of OOP in Java but nothing more. That is kind of strange since Java is so strongly focused on OOP.

For your second question: minutes is the name of the argument you give the method solveMaze. The code inside solveMaze can access the primitive/object you gave it as an argument. When you actually use the function you'd write


to, I dunno, solve the maze in 5 minutes? :stuck_out_tongue:.


Yeah man I see what you mean, I have a book called "Head First Java," Ill probably start reverting back to that more and more. I actually tried to learn java in the past. This part always gets me. haha, anyways im 50% done the Java course here, it was mostly a refresher but I never got past going out side of main. :stuck_out_tongue:

I wont give up! :smile: