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
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.