CopyPastor

Detecting plagiarism made easy.

Score: 0.9800799508671184; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2016-10-21
by jaspreet Kaur

Original Post

Original - Posted on 2015-04-22
by Sunil Rajashekar



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Change the delimiter as @kayKay mentioned, You are trying to read the line again. I think you shouldn't ??
public static void main(String[] args) { try { br = new BufferedReader(new FileReader(theFile)); String line = null; while ((line = br.readLine()) != null) { String[] aLine = line.split("\t"); // Also as kaykay mentioned change /t to \t //br.readLine(); // You are reading the line again - Comment it out numLine.add(aLine); } } catch (IOException e){ } finally { try { br.close(); } catch (Exception e) { } } for (int i=0; i < numLine.size(); i++){ for (int j = 0; j < numLine.get(i).length; j++){ System.out.print(numLine.get(i)[j] + " "); // if (!((numLine.get(i)[j]).equals("\t"))){ intList.add(Integer.parseInt(numLine.get(i)[j])); } System.out.println(); }
The tab character is represented by \t and not /t (line.split("\\t");). Additionally, you will need to add validation checks that each line you read is actually an Integer
Change the delimiter as @kayKay mentioned, You are trying to read the line again. I think you shouldn't ??
public static void main(String[] args) { try { br = new BufferedReader(new FileReader(theFile)); String line = null; while ((line = br.readLine()) != null) { String[] aLine = line.split("\t"); // Also as kaykay mentioned change /t to \t //br.readLine(); // You are reading the line again - Comment it out numLine.add(aLine); } } catch (IOException e){ } finally { try { br.close(); } catch (Exception e) { } } for (int i=0; i < numLine.size(); i++){ for (int j = 0; j < numLine.get(i).length; j++){ System.out.print(numLine.get(i)[j] + " "); // if (!((numLine.get(i)[j]).equals("\t"))){ intList.add(Integer.parseInt(numLine.get(i)[j])); } System.out.println(); }

        
Present in both answers; Present only in the new answer; Present only in the old answer;