Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cannot resolve symbol

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help I am getting 4 errors when I try to compile this program. Can someone tell me what the problem is? Thanks for your help. I think this site is wonderful.
Check.java:14: cannot resolve symbol
symbol : method isRight (int,int,int)
location: class Check
right = isRight (A, B, C);
^
Check.java:15: cannot resolve symbol
symbol : method isScalene (int,int,int)
location: class Check
scalene = isScalene (A, B, C);
^
Check.java:16: cannot resolve symbol
symbol : method isIsosceles (int,int,int)
location: class Check
isosceles = isIsosceles (A, B, C);
^
Check.java:17: cannot resolve symbol
symbol : method isEquilateral (int,int,int)
location: class Check
equilateral = isEquilateral (A, B, C);
^
Here is the code:

Edited by Cindy to format code.
[This message has been edited by Cindy Glass (edited March 05, 2001).]
 
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your first line of code:

You have to specify what class you are importing. Im not sure which one your triangle example is under, but your import statement should look something like this:
import java.awt.container;
import java.awt.*;
import java.util.*;
You have to use the full "java." name. Hope that helps.

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I think the problem is you haven't defined the methods isIsosceles (A, B, C), isScalene (A, B, C) , isRight (A, B, C) , & isEquilateral (A, B, C) in your code at all.
As per my knowledge these are not predefined methods of any java package.So the answer could be that you should define these method before you give a call to them.
If you define these methods ...your code should look something like this..........
//import java.awt.container;
import java.awt.*;
import java.util.*;
public class Check{
public int isIsosceles (A, B, C){
// method implementation here
return //return value here
}
public int isScalene (A, B, C){
// method implementation here
return //return value here
}
public int isRight (A, B, C){
// method implementation here
return //return value here
}
public int isEquilateral (A, B, C){
// method implementation here
return //return value here
}
public static void main (String[] args){
int A, B, C, isosceles, scalene, right, equilateral;
System.out.println ("This program will help determine"
+ "what kind of triangle you have.");
A=3;
B=4;
C=5;
isosceles = isIsosceles (A, B, C);
scalene = isScalene (A, B, C);
right = isRight (A, B, C);
equilateral = isEquilateral (A, B, C);

System.out.println ("The triangle is: ");
if (right == 1)
System.out.println ("Right");
if (scalene == 1)
System.out.println ("Scalene");
if (isosceles == 1)
System.out.println ("Isosceles");
if (equilateral == 1)
System.out.println ("Equilateral");
}
}

 
Andy Ceponis
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My above post about the import statements was just an example of what they should look like. I know that those are not the right ones, but just examples. I was assuming that you were trying to import those methods from the triangle class. If im wrong, then ignore what i posted. :>
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kelly,
I saw your Triangle class in another post. The problem is not really about what you're importing. It is about the fact that the methods you call (isScalene, isEquilateral) aren't in the Check class and you haven't given any indication of where they can be found. Having seen the Triangle class, I know that the methods aren't static - so to call these methods, you have to create an instance of the Triangle class and then call the methods using this instance. This code worked for me:-

I didn't have to import anything because I compiled both Triangle (with a few changes) and Check in the same default package. If the classes are in different packages, you will need an import statement.
Hope this helps,
Kathy
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic