Note that there are some explanatory texts on larger screens.

plurals
  1. POError saying that my methods are undefined
    primarykey
    data
    text
    <p>Ok, so I am following the Java tutorials on the <a href="http://bit.ly/17algmZ" rel="nofollow">BrandonioProdtuctions</a> YouTube channel and. I am on Part 7:Intro to Object Oriented Programming. The problem I am having is that when I try to run the program it gives me errors in the class (titled objectIntroTest) that I have pasted directly below. </p> <pre><code>public class objectIntroTest { public static void main(String[] args){ String x = "Hello"; objectIntro waterBottle = new objectIntro(0); waterBottle.addwater(100); waterBottle.drinkWater(20); System.out.println("Your remaining water level is:"* + waterBottle.getWater()); } } </code></pre> <p>This is the other class, titled "objectIntro":</p> <pre><code>public class objectIntro { public objectIntro(){ //Default constructor } public objectIntro(int waterAmount){ twater = waterAmount; } int twater = 0; //This is how much water is in the water bottle public void addWater(int amount){ twater = twater + amount; } public void drinWater(int amount){ twater = twater - amount; } public int getWater(){ return twater; } } </code></pre> <p>Here is the error message it gives me when I try to run the program:</p> <pre><code>Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method addwater(int) is undefined for the type objectIntro The method drinkWater(int) is undefined for the type objectIntro The operator * is undefined for the argument type(s) String, int at objectIntroTest.main(objectIntroTest.java:6) </code></pre> <p>Why does this happen?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload