Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: method undefined error

  1. #1
    Member
    Join Date
    Oct 2011
    Posts
    40
    My Mood
    Stressed
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default method undefined error

    I am getting the error message "The method getCurrentTime() is undefined for the type lightQueue, and the same thing for getEndTime().
    I know that eclipse can see my other class and these methods because my lightStatus() and introduction() calls are working fine. I have read a bit about how to resolve this, but none if it seems to apply. THe methods I am calling are simple getters with an int return value.

    	public static void run(){
    lightQueue lightQueue = new lightQueue();
    		lightQueue.introduction();
    		while(lightQueue.getCurrentTime()<= lightQueue.getEndTime()){
     
    		}
    		lightQueue.lightStatus();
     
    		lightQueue.endSimulation();
     
    	}


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: method undefined error

    First, for future reference post an SSCCE - we do not know what lightQueue is, and where those methods are defined. Second, I would recommend reading the following describing code conventions for the language: Code Conventions for the Java Programming Language I point you to this given the following line of code:
    lightQueue lightQueue = new lightQueue();

    What is lightQueue? A class, or a variable? How does the compiler (or the programmer) distinguish between the two?

Similar Threads

  1. Replies: 3
    Last Post: October 28th, 2011, 04:42 PM
  2. constructor X is undefined
    By ober0330 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: August 24th, 2011, 01:51 PM
  3. Undefined Array Problem
    By oakheart in forum Other Programming Languages
    Replies: 2
    Last Post: April 18th, 2011, 09:19 AM
  4. where is the error in this method !
    By M7MD in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 9th, 2010, 05:08 PM
  5. he operator / is undefined for the argument type(s) String, int
    By mtbr00x in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: September 8th, 2009, 08:34 PM