• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Can't resolve compiler error message

Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please Disregard I figured out the errors of my way.. Thanks Ryan

I have a button that says print: when pushed i want to print my array:
heres is the error message that I get:
Cannot Resolve Symbol:
Symbol: Variable input Location: class FirstArray
Here is my code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FirstArray extends JApplet
implements ActionListener
JLabel label = new JLabel("enter Integers's");
JTextField inputText = new JTextField(10);
JTextArea output = new JTextArea(10,15);
JScrollPane sp = new JScrollPane( output );
JButton print = new JButton("Print Array");
int count = 0;

public void init()
Container c = getContentPane();
c.setLayout(new FlowLayout());
print.addActionListener(new display());


public void actionPerformed(ActionEvent e)
int[] input = new int[20];

if ( count < input.length ){
input[count] = Integer.parseInt(inputText.getText());
output.append(Integer.toString(input[count]) + "\n");
showStatus("Please Enter Another Integer");
if( count == input.length){
output.append("Thank You\n" + "Your Done\n\n");
showStatus("Your Done");
private class display implements ActionListener
public void actionPerformed(ActionEvent e)
for(int i = 0; i < input.length; i++){
output = output.append(Integer.toString(input[i]));

[This message has been edited by Ryan Perlman (edited November 15, 2001).]
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ryan Perlman:


The variable input is local to the method actionPerformed in the class FirstArray. So you can not access it from your local inner class Display. You should make input an instance variable for example.
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic