Hi all, I have just started to learn java.
The trial code I have is showing errors at compiling.
Here is the code.
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class ppp {
public static void main(String args[]) throws FileNotFoundException {
//Scanner Example - read file line by line in Java using Scanner
FileInputStream fis = new FileInputStream("C:/sample.txt");
Scanner scanner = new Scanner(fis);
//reading file line by line using Scanner in Java
//System.out.println("Reading file line by line in Java using Scanner");
while(scanner.hasNextLine()){
System.out.println(scanner.nextLine());
String assetClasses = scanner.nextLine();
String[] splits = asseltClasses.split("\t");
System.out.println(scanner.nextLine());
System.out.println("splits.size: " + splits.length);
for(String asset: assetClasses){
System.out.println(asset);
}
}
scanner.close();
}
}
Below is the errors.
ppp.java:29: cannot find symbol
symbol : variable asseltClasses
location: class ppp
String[] splits = asseltClasses.split("\t");
^
ppp.java:33: foreach not applicable to expression type
for(String asset: assetClasses){
^
2 errors
Pl help.
Regards,
Madiya