CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    2

    Error??? help please!!! :]

    ok...here's the code, and the error says:
    cannot find symbol class IntClass

    Code:

    import java.util.*;
    import java.io.*;

    public class ex
    {
    static Scanner console = new Scanner(System.in);

    public static void main (String[] args)
    {
    int first, third;
    IntClass second, fourth;

    first = 3;
    second = new IntClass(4);
    third = 6;
    fourth = new IntClass(7);

    System.out.println(first + " " + second.getNum() + " " + third + " " + fourth.getNum());
    getData(first, second, third, fourth);
    System.out.println(first + " " + second.getNum() + " " + third + " " + fourth.getNum());
    fourth.setNum(first * second.getNum() + third + fourth.getNum());
    getData(third, fourth, first, second);
    System.out.println(first + " " + second.getNum() + " " + third + " " + fourth.getNum());
    }

    public static void getData(int a, IntClass b, int c, IntClass d)
    {
    a = console.nextInt();
    b.setNum(console.nextInt());
    c = console.nextInt();
    d.setNum(console.nextInt());

    b.setNum(a * b.getNum() - c);
    d.setNum(b.getNum() + d.getNum());
    }
    }

  2. #2
    Join Date
    Feb 2008
    Posts
    38

    Re: Error??? help please!!! :]

    Did you declare IntClass? Or you want to use wrapper class?

    Code:
    IntClass second, fourth;

  3. #3
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: Error??? help please!!! :]

    There isn't an IntClass in the standard jdk, did you mean to use the class Integer.

  4. #4
    Join Date
    Mar 2008
    Posts
    2

    Re: Error??? help please!!! :]

    I think so, but this was a problem from my workbook and i was suppose to figure out the output, but this keeps showing up, how do i declare it?

  5. #5
    Join Date
    Apr 2007
    Posts
    442

    Re: Error??? help please!!! :]

    You dont. Unless you find IntClass specified somewhere in your course material and take it from there. Are you sure this is a coding excercise and not some brains-and-paper-only level mindwork?

    If you are convinced that you are supposed to figure this out by code, then either use int, or its wrapper class Integer, or... then your course material should have some indication of what intClass actually is.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured