-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.java
More file actions
32 lines (22 loc) · 829 Bytes
/
Copy pathtest.java
File metadata and controls
32 lines (22 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class error{
public static void main(String[] args) {
// 1. Missing semicolon
int x = 10
// 2. Unused variable
int unusedVariable = 100;
// 3. Undeclared variable
int y = undeclaredVar + 5;
// 4. Type mismatch
String z = 50;
// 5. Missing brackets
if (x > 5)
System.out.println("X is greater than 5");
// 6. Hardcoded password
String password = "mySecret123";
// 7. SQL Injection risk
String userInput = "admin";
String query = "SELECT * FROM users WHERE name = '" + userInput + "'";
statement.executeQuery(query);
// 8. Undefined method call
callThisDoesNotExist();
// <-- 9. Missing closing brace for main method and class