Question
Write a program that reads a line of text input by the user and places each word in a TreeSet. Print the elements of the
Write a program that reads a line of text input by the user and places each word in a TreeSet. Print the elements of the TreeSet to the screen. This will cause the elements to be printed in ascending order. Include your name at the top of your source file. Use proper indentation, like you see in the book. Your class must be in a package named mypackage, as explained in last week's videos and be named TreeSetUse. Upload TreeSetUse.java. This is my code:
import java.util.Scanner; import java.util.TreeSet; package mypackage;
public class TreeSetUse { public static void main(String[] args) { Scanner sc = new Scanner(System.in); TreeSet
This is the error message I received:
Exception in thread "main" java.lang.Error: Unresolved compilation problem: at mypackage.TreeSetUse.main(TreeSetUse.java:7)
Can someone help me understand how to resolve this?
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