Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Default Error during compilation.

    import java.util.*;
    class x
    l {
    int a,b;
    void function(int m,int n)
    {
    a=m;b=n;
    }
    int sum()
    {
    int c;
    c=a+b;
    return(c);
    }
    public static void main()
    {
    Scanner obj1=new Scanner(System.in);
    x obj2=new x();
    int p,q,s;
    System.out.println("Enter the no.");
    p=obj1.nextInt();
    q=obj1.nextInt();
    obj1.input(p,q);
    s=obj2.sum();
    System.out.println("sum="+s);
    }
    }




    I get an error in line 23 which says cannot find symbol-method input(int,int) in line

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    9

    Default Re: Error during compilation.

    Java is not lying, Scanner does not have such a method. You can see that in the javadocs:

    Scanner (Java Platform SE 7 )

    Looking at your very hard to read code, it looks like you wanted to call obj2.function() in stead.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,027
    Rep Power
    23

    Default Re: Error during compilation.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. compilation error
    By jovin555 in forum New To Java
    Replies: 3
    Last Post: 01-31-2013, 05:53 PM
  2. Compilation error
    By gnarkill10 in forum New To Java
    Replies: 2
    Last Post: 08-05-2012, 03:18 PM
  3. MIB compilation error - lexical error [0050]
    By ajuthani4@hotmail.com in forum Networking
    Replies: 0
    Last Post: 02-28-2012, 07:09 PM
  4. Help with a compilation error
    By m_mccutcheon in forum New To Java
    Replies: 5
    Last Post: 08-15-2011, 05:20 PM
  5. compilation error
    By NoufalpRahman in forum Java Servlet
    Replies: 0
    Last Post: 04-26-2011, 08:08 PM

Tags for this Thread

Posting Permissions

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