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
0
votes
2 answers

Java constructor cannot find symbol error ' = new'

I am trying to initialize one Java class from within a conditional in another class - I want MarsRovers to initialize Rover. I am getting a 'cannot find symbol' error when I try to initialize a Rover object from MarsRovers. I am new to Java so I…
0
votes
3 answers

Cannot find symbol - method: toUppercase(char)?

I'm working on a Pig Latin method and now I'm trying to do the if-else statement: if Start word is capitalized, lowercase Start and uppercase End. This is so if a word is at the beginning of a sentence or is just capitalized in general (Ex. John),…
Sen Park
  • 11
  • 1
  • 1
0
votes
2 answers

Why are variable not recognised from inside for-statements?

What I am trying to do is create an array that pulls even numbers from another array. I'm not sure if I have gone about it the right way. I've look for ways of returning from statements like you would functions/methods and I can't find anything, not…
0
votes
2 answers

JOptionPane Cannot Find Symbol

I am trying to create a simple calculator using JOptionPane. I have encountered compiling errors. import javax.swing.JOptionPane; public class Calculator { public static void main ( String args[] ) { double n1 =…
Gianna Caruso
  • 113
  • 2
  • 3
  • 14
-1
votes
1 answer

cannot find symbol even the classes are in same package , same directory

I have two classes, one is Course, another is CourseController. They are in the same package , same path; But when I compile javac CourseController.java, Intellij says :"error: cannot find symbol" Course: package…
nick nick
  • 1
  • 1
-1
votes
1 answer

'error: cannot find symbol' in Java method that looks for second occurrence of substring

I am writing a method that looks for the index of the second occurrence of a substring in an array. It finds the index of the first occurrence fine. Next, I tried to create the loop that would start from the first index, but it didn't work. It says…
Anya
  • 7
  • 1
-1
votes
1 answer

I keep getting "error: cannot find symbol" message while trying to put responses

import java.util.Scanner; public class Outside{ public static void main (String[] args){ Scanner scan = new Scanner (System.in); System.out.print("Is your homework done? "); String homework; homework = scan.nextLine(); …
-1
votes
2 answers

How can i solve the 'cannot find symbol' problem?

If I compile this, I get 'cannot find symbol' errors with the setDefaultCloseOperation, setSize and setVisible. My problem is I don't understand why. and This is the part of myhomework. But I can't even start next part Because of this…
Ethan
  • 1
  • 2
-1
votes
1 answer

Why is the compiler saying "cannot find symbol" to the getter methods?

When I try to compile the code, it keeps saying "cannot find symbol" every single time I try to call a getter method. I'd love any and all suggestions as to how to fix the problem. Here is the code with the main method import…
-1
votes
1 answer

Why is java 8 unable to identify the integer array (y) passed to this method?

public class Solution { public static int solution(int[] x, int[] y) { // for every value in x for (int v : x){ // check if value exists in y boolean i = y.contains(v); // if indicator returns…
-1
votes
1 answer

Cannot Find a Symbol

The CalculatorDemo1 class package calc; public class CalculatorDemo1{ public static void main(String args){ int integer1 = 1; int integer2 = 2; Calculator a = new Calculator(integer1, integer2); a.sum(); } } The Calculator…
-1
votes
1 answer

Trying to use JButtons

I'm trying to use JButton components in two different .java files in the same package. When I try compiling the code from two different java files in the same package it shows compiler errors. When I try moving the main class to the same file as…
-1
votes
1 answer

Writing a program from our Java textbook as an exercise. I have it exactly as the book has it, but it keeps giving me "Cannot find symbol errors"

I am writing a program out from my Java textbook as practice for writing our own similar program. I have it written exactly as it appears in our book (Starting Out With Java, From Control Structures Through Data Structures, 3rd Edition, Page 833)…
-1
votes
2 answers

how to use method from another class?

I think I have my method set properly to give me the total number of rooms but it won't compile. Where did I go wrong? public class Hotel { public static int singleRooms; public static int doubleRooms; public static int kingRooms; …
-1
votes
1 answer

cannot find Symbol . in generic class LinkedList

I am new to java and coming form c++ background. i have encountered a problem while making a generic class with comparable interface. In the SearchByID and SerchByName methods of LinkedList class it gives error on temp.value.getID() and…
Hassaan Elahi
  • 43
  • 1
  • 7