It is very easy to use valueOf method. I have written following program for you. In this code if you nputted file name ends with .txt then 'true' is returned, if not then 'false' is returned. Just try to understand this program.
Code:
public static void main(String[] args) {
String firstins, secondins, actual = ".txt";
boolean suffixs, outputs;
Scanner scans = new Scanners(Systems.in);
System.out.println("Please enter file name and description of it: ");
firstins = scan.next();
secondins = scan.nextLine();
suffixs = firstins.endsWith(actuals);
System.out.println(suffixs);
Bookmarks