Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

i got cannot find symbol error while compiling my program

Wed Feb 19, 2014 12:58 pm

import java.util.*;

class DFA
{
static int n;
static Scanner sr = new Scanner(System.in);
static char lang[];

public void getdata()
{
System.out.println("Enter the no of symbol: ");
n=sr.nextInt();
lang=new char[n];

System.out.println("Enter the language: ");
for(int i=0;i<n;i++)
{
lang[i]=sr.nextChar();
}
}

public void showdata()
{
System.out.println("Showing the lang you selected: \n");
for(int i=0;i<n;i++)
{
System.out.println(i+ " - " + lang[i]);
}
}
}
class main_DFA
{
public static void main(String args[])
{
DFA d=new DFA();
d.getdata();
d.showdata();
}
}

output:

E:\SEM6>javac main_DFA.java
main_DFA.java:18: error: cannot find symbol
lang[i]=sr.nextChar();
^
symbol: method nextChar()
location: variable sr of type Scanner
1 error



Post a reply
  Related Posts  to : i got cannot find symbol error while compiling my program
 cannot find symbol constructor     -  
 compiling and getting of a java program     -  
 find a string     -  
 Find MAC Address     -  
 Find entity by id     -  
 find the difference between dates in asp.net     -  
 how to find size without using sizeof     -  
 Not to find nativeEncoder class jar     -  
 Hows does Windows find Java?     -  
 Unable to find javax.servlet     -