From 49df5c6cf0d9129255e51e69bad20ef158a261e5 Mon Sep 17 00:00:00 2001 From: Mayank Singh <126546883+mayanksingh0307@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:27:41 +0530 Subject: [PATCH 1/3] Create comilationerros --- comilationerros | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 comilationerros diff --git a/comilationerros b/comilationerros new file mode 100644 index 0000000..d9920ad --- /dev/null +++ b/comilationerros @@ -0,0 +1,25 @@ +public class CompilationErrors { + public static void main(String[] args) { + // 1. Missing semicolon + System.out.println("Hello, World") + + // 2. Undefined variable + int result = a + 5; + + // 3. Method not defined + printMessage("This will cause an error"); + + // 4. Incorrect method signature + public void incorrectMethod() { + System.out.println("This method signature is incorrect"); + } + + // 5. Mismatched data types + String number = 12345; + } + + // 3. Method not defined - Correct definition for reference + // public static void printMessage(String message) { + // System.out.println(message); + // } +} From d45bb8b65f9314cc105bf1b27f16bc12c0e18698 Mon Sep 17 00:00:00 2001 From: Mayank Singh <126546883+mayanksingh0307@users.noreply.github.com> Date: Fri, 28 Jun 2024 15:39:56 +0530 Subject: [PATCH 2/3] Update comilationerros --- comilationerros | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/comilationerros b/comilationerros index d9920ad..30b227f 100644 --- a/comilationerros +++ b/comilationerros @@ -1,24 +1,19 @@ public class CompilationErrors { public static void main(String[] args) { - // 1. Missing semicolon System.out.println("Hello, World") - // 2. Undefined variable int result = a + 5; - // 3. Method not defined - printMessage("This will cause an error"); + printMessage("This is 1"); - // 4. Incorrect method signature - public void incorrectMethod() { - System.out.println("This method signature is incorrect"); + public void correctMethod() { + System.out.println("This method"); } - // 5. Mismatched data types String number = 12345; } - // 3. Method not defined - Correct definition for reference + // public static void printMessage(String message) { // System.out.println(message); // } From de8619f672a7fd5b2ad8c75a421fa90890924685 Mon Sep 17 00:00:00 2001 From: Mayank Singh <126546883+mayanksingh0307@users.noreply.github.com> Date: Fri, 28 Jun 2024 16:36:23 +0530 Subject: [PATCH 3/3] Rename comilationerros to comilationerros.java --- comilationerros => comilationerros.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename comilationerros => comilationerros.java (100%) diff --git a/comilationerros b/comilationerros.java similarity index 100% rename from comilationerros rename to comilationerros.java