Skip to main content

index program

1 reply [Last post]
reils10
Offline
Joined: 2007-03-23
Points: 0

i have to write a program which indexes a bunch of words, but i keep getting these error messages when i try to compile:

--------------------Configuration: --------------------
G:\Documents\Node.java:109: class lab4 is public, should be declared in a file named lab4.java
public class lab4
^
G:\Documents\Node.java:78: cannot find symbol
symbol : variable cisio
location: class Token
s = cisio.GetLine();
^
G:\Documents\Node.java:89: cannot find symbol
symbol : variable cisio
location: class Token
if (cisio.eof())
^
G:\Documents\Node.java:91: cannot find symbol
symbol : variable cisio
location: class Token
s = cisio.GetLine();
^
G:\Documents\Node.java:92: cannot find symbol
symbol : variable cisio
location: class Token
if (cisio.eof())

I'm not sure what the problem is, I've been working on this for days! if anyone can help me out I'd appreciate it. my code is below:

import java.util.*;
import java.text.*;

class Node
{
int numlines;
String Symbol;
int lines[];
Node next;
Node(Token t)
{
Symbol = new String(t.token);
lines = new int [200];
lines[0] = t.linenr;
numlines = 1;
next = null;
}
void addline(int n)
{
lines[numlines++] = n;
}
void display()
{
int i;
System.out.print(Symbol + " ");
for (i = 0; i

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
forax
Offline
Joined: 2004-10-07
Points: 0

wrong forum, try this one :
http://forum.java.sun.com/forum.jspa?forumID=54

to answer to your question, the name of a java file must be the same that
the public class. In your example, you must rename Node.java to lab4.java
or remove the modifier public of class lab4.

Rémi