Questions tagged [cannot-find-symbol]

This tag is used when code returns an error message that a symbol cannot be located. These are usually compilation errors in Java.

This tag is used when code returns an error message that a symbol cannot be located. Such messages are usually associated with compilation errors in Java. See this post for a detailed description of causes and solutions: What does a "Cannot find symbol" compilation error mean?

251 questions
1
vote
1 answer

Yet another 'cannot find symbol' error when creating a new class object

In short, I'm trying to instantiate within the main method in order to handle computations. I wrote the main class in Eclipse and was able to compile and run everything smoothly. Main Method: public static void main(String[] args) { ... …
Oleg Silkin
  • 508
  • 1
  • 5
  • 12
1
vote
2 answers

Cannot find symbol on method

i'm creating the method toArray in the code below, getting cannot find symbol error in calling both pop() and push() methods inside toArray. Why? public void push(Comparable x) { arr[size++] = x; } public Object pop() throws…
1
vote
1 answer

Cannot find symbol on comparable array

I have to build a stack of comparable objects from a given interface. Inside the class, this is my constructor: public S() { Comparable[] arr = new Comparable[INITSIZE]; size = 0; } Now, in every method where the array appears, for…
1
vote
3 answers

Accessing the methods of a member of an Object[] array

I have to create an array of objects to then be randomly filled. In this array I need to put 100 random, Person(base) Student(sub), Professor(sub), Course(an array of Student plus a Professor), and a Circle(unrelated). I also have to name and count…
1
vote
1 answer

Cannot resolve symbol error when importing OpenCv4Android in Android Studio

I want to use OpenCV4Android in Android Studio. I downloaded OpenCV for Android from this link: http://opencv.org/downloads.html But, when I try to import it, I get different errors in Camera2Renderer.java like, Cannot resolve symbol 'camera2',…
Dania
  • 1,648
  • 4
  • 31
  • 57
1
vote
1 answer

Cannot find Symbol - variable. In main method when symbol is used in other method

This program is used to calculate Pi by random numbers of throws(x,y coordinates) then iterate the whole process a number of times. I get an error on the last line of code double average = average(pi) where it says cannot find symbol variable pi,…
1
vote
2 answers

Basic Java - Coding in text editor, cannot create new object from a different file although they're in the same package "Cannot find symbol"

This code compiles fine: Person.java package people; class Person{ private String name; private int age; public Person(String name, int age){ this.name = name; this.age = age; } public String getName(){ return name; } public…
Logan
  • 33
  • 6
1
vote
0 answers

"Cannot find symbol error" inside action listener

I am trying to create an action listener that will pull variable information from outside the action listener class, and using that data, will call a method to do a calculation. After that, I want the action listener to update my pane with the…
carchelhf
  • 51
  • 1
  • 3
1
vote
1 answer

Cannot resolve symbol variable getSelectedIndex

I was having trouble trying to copy and paste the code here it said something about having unformatted?? i dont know its my first time but here is the troublesome code i'll link a pastebin so you can see too whole code:…
Oscar Cubz
  • 33
  • 4
1
vote
4 answers

Basic java program cannot find symbol error

I need help with this basic program. My friend had given me most of this code but not the import statements. Towards the end where it says list.add(finalCombined.get(counter3)); , it gives me an error. The error I get is Cannot find Symbol Symbol:…
Anthony D
  • 19
  • 2
1
vote
4 answers

Java - Cannot find the symbol of an inner class that implements an ActionListener

I'm going off of what I saw in a textbook to make an action listener for a button. To do it, I made an inner class. When I try to call the inner class, the error comes up: cannot find symbol. Here's the code: package GUI; import java.awt.*; import…
aaa
  • 13
  • 5
1
vote
3 answers

cannot find symbol - variable in java

I have this Java code public class SlumbookDriver{ public static void main(String args[]){ Slumbook[] contacts = new Slumbook[19]; autoAdd(); String con1 = contacts[0].viewToString(); System.out.println(con1); } with the method…
user253938
  • 173
  • 17
1
vote
0 answers

Getting the "cannot find Symbol" error when referencing a method from another class

I am writing a WAR game and have 3 files. The Card class has the definition for a card and the methods to manipulate a card. The FullDeck class the methods to create a card and a deck of cards. The code is shown here. public class FullDeck { public…
1
vote
1 answer

Java Object Serialization ,Unable to close ObjectOutputStream?

hi i'm learing Object Serialization and tried this import java.io.*; class Employee implements Serializable{ Employee(int temp_id,String temp_name) { id=temp_id; name=temp_name; } int id; String…
1
vote
2 answers

I keep getting "error: cannot find symbol" for two interface classes even though classes are in the same directory

So, I'm really baffled by this. I'm working on a homework assignment that involves creating a Heap class and a PriorityQueue class that implement interfaces. Two of the interfaces are for the Heap and PriorityQueue classes, and the third is a…