Question
Edit: I tried copying it into a new file and it says the same thing I keep getting this error on every line of my
Edit: I tried copying it into a new file and it says the same thing
I keep getting this error on every line of my java code
Combine.java:6: error: illegal character: '\u00a0'
I wasn't getting this error before and I don't know what it means
class Combine implements Combinable { // YOUR CODE UNDER THIS COMMENT public boolean validateChar(char ch) { if ((ch == '4') || (ch == '2') || (ch == '_')) { return true; } else { return false; } } // Validate each Char in row with size 3 public boolean validateRow(String row) { if (row.length() != 3) { return false; } else { if (validateChar('2') == true) { return true; } if (validateChar('4') == true) { return true; } if (validateChar('_') == true) { return true; } return false; } } public String moveLeft(String row) { if (!validateRow(row)) { return row; } else { nRow = ""; } CharC0= row.charAt(0); CharC1= row.charAt(1); CharC2= row.charAt(2); if (C0 != '_') { nRow += C0; } if (C1 != '_') { nRow += C1; } if (C2 != '_') { nRow += C2; } nL= nRow.length(); nU= 3 - nL; if (nU == 1) { nRow += '_'; } else if (nU == 2) { nRow += "__"; } else if (nU == 3) { nRow += "___"; } else { return nRow; } } public String combineLeft(String row) { if (C0 == '_') { return "___"; } if (C0 == C1) { if (C0 == 2) { nRow += '4'; } else if (C0 == 4) { nRow += '8'; } nRow += C2; } else { nRow += C0; if (C1 == C2) { if (C1 == 2) { nRow += '4'; } else if (C1 == 4) { nRow += '8'; } } else { nRow += C1 + C2; } nL= nRow.length(); nU= 3 - nL; if (nU == 1) { nRow += '_'; } else if (nU == 2) { nRow += "__"; } else if (nU == 3) { nRow += "___"; } else { return nRow; } } } } // The main is used to test your code public static void main(String[] args) { // The following are asserts used to test your code Combine A = new Combine(); assert A.validateChar('2') : "2 should be a valid char"; assert A.validateChar('4') : "4 should be a valid char"; assert A.validateRow("242") : "242 should be valid"; assert !A.validateRow("246") : "246 should NOT be valid"; assert "4__".equals(A.moveLeft("__4")) : "__4 doesn't change to 4__"; assert "24_".equals(A.moveLeft("2_4")) : "2_4 doesn't change to 24_"; assert "242".equals(A.combineLeft("242")) : "242 doesn't change to 242"; assert "4__".equals(A.combineLeft("22_")) : "22_ doesn't change to 4__"; assert "8__".equals(A.combineLeft(A.combineLeft("422"))) : "Double invocation doesn't work!"; assert "84_".equals(A.combineLeft(A.combineLeft("444"))) : "Double invocation doesn't work!"; //You should be using your own validation asserts to check for erroneous inputs! assert "__".equals(A.combineLeft("__")) : "__ should be invalid!"; System.out.println("All tests passed. VICTORY!"); } }
Step 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