Question: Can someone tell me what is wrong with this code and how to fix it? import components.simplereader.SimpleReader; import components.simplereader.SimpleReader1L; import components.simplewriter.SimpleWriter; import components.simplewriter.SimpleWriter1L; import components.xmltree.XMLTree;

Can someone tell me what is wrong with this code and how to fix it?

import components.simplereader.SimpleReader; import components.simplereader.SimpleReader1L; import components.simplewriter.SimpleWriter; import components.simplewriter.SimpleWriter1L; import components.xmltree.XMLTree; import components.xmltree.XMLTree1;

/** * Put a short phrase describing the program here. * * @author Put your name here * */ public final class longestText {

/** * Private constructor so this utility class cannot be instantiated. */ private LeafCount() { }

private static String longestText(XMLTree t) {

String longest = ""; int max = 0; int count = 0; if (t.isTag()) { for (int i = 0; i < t.numberOfChildren(); i++) { longest = longestText(t.child(i)); if (!t.child(i).isTag()) { count = t.child(i).label().length(); if (count > longest.length()) { longest = t.child(i).label();

}

}

}

}

return longest; }

public static void main(String[] args) { SimpleReader in = new SimpleReader1L(); SimpleWriter out = new SimpleWriter1L();

out.println("Please enter an RSS link: "); String web = in.nextLine();

XMLTree xml = new XMLTree1(web);

String word = longestText(xml); out.println(word); in.close(); out.close(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!