So i'm trying to take user input that has a extension like .txt or .html but I'm not sure if you can do String slicing in Java like you can in Python. Could I please get some help? I'm trying to understand the concept and not just get an easy answer.
import java.util.Scanner;
public class FileReader {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter a file name and its extension!");
String fileName = keyboard.next();
System.out.println(fileName);
String[] parts = fileName.split("");
String ext = parts[0];
}
/* ADD YOUR CODE HERE */
}