Question
Hi, I'm trying to do this Java project with Eclipse, but cannot run input file, even though I created file with system . Please help
Hi, I'm trying to do this Java project with Eclipse, but cannot run input file, even though I created file with system . Please help me with that. Thanks.
Write a program that asks the user for the names of two files. The first file should be opened for reading and the second file should be opened for writing. The program should read the contents of the first file, change all characters to uppercase, and store the results in the second file. The second file will be a copy of the first file, except that all the characters will be uppercase. Use Notepad or another text editor to create a simple file that can be used to test the program.
2e import java.util.Scanner; 3 import java.io.*; l 4 6 public class Fieconvertec { 8 public static void main(String[] args) throws IOException 9 10 Scanner scan- new Scanner(System. in); System.out.print( Enter the First file name: "); String filename! = scan.nextLine(); File file new File(filename1); while(file.exists)) 12 13 14 15 16 17 18 19 20 21 System.out.println(filenamel " does not exist. Please try again."); filename! = scan.nextLine(); file-new File(filename1); 23 24 25 26 27 28 29 30 31 32 Scanner fileToScannew Scanner(file); Printwriter fileTowrite new Printwriter("text2.txt"); while(fileToScan.hasNext)) { fileToWrite.println(fileToScan.nextLine().toUpperCase()); 34 35 36 37 38 39 fileTowrite.close) fileToScan.close); 45Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started