Results 1 to 4 of 4

Thread: Variable error

  1. #1
    luke is offline Member
    Join Date
    Sep 2010
    Posts
    62
    Rep Power
    0

    Question Variable error

    Java Code:
    public class Work {
    
    	private int n;
    	
    	void testMethod(n){
    		.
                    .
                    .
    	}
    }

    Hello folks,

    Why does Eclipse give me an error when tries to compile the above code? It says "n cannot be resolved to a type".

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    When declaring a method you need to specify the types of the parameters.

  3. #3
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    5

    Default

    void testMethod(int n) !!!!!!

    --> Classes

  4. #4
    luke is offline Member
    Join Date
    Sep 2010
    Posts
    62
    Rep Power
    0

Similar Threads

  1. Error "variable is never read"
    By Phitur in forum New To Java
    Replies: 6
    Last Post: 09-07-2010, 05:30 AM
  2. Error "can not find symbol variable"
    By FullMetalHollow in forum New To Java
    Replies: 5
    Last Post: 10-04-2009, 09:51 PM
  3. Replies: 0
    Last Post: 09-03-2009, 10:46 AM
  4. Replies: 1
    Last Post: 08-01-2007, 09:25 PM
  5. Variable passing, Error: IOException
    By fernando in forum New To Java
    Replies: 3
    Last Post: 07-31-2007, 02:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •