Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Recompile with -Xlint problem, I've been able to fix it in the past but this time is difficult

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Recompile with -Xlint problem, I've been able to fix it in the past but this time is difficult

    The jist of the program is to create a Stack of Strings to store a list of names and a Queue that stores all the stacks of names.
    The problem is I'm getting the
    Note: G:\AP Computer Science AB\Chapter 3\Labs\SplahMountain.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Error in the compiler

    I know how to fix this error through casting, but I cant seem to find what I did wrong here. Maybe you guys can help. I'd really appreciate it.

    import java.util.*;
    import java.text.*;
    import java.io.*;
     
     
    public class SplahMountain 
    {
    	public static void main(String[] args)
    	{
    		Queue<String> q = new LinkedList<String>();
    		Stack<Queue> s = new Stack<Queue>();
     
    		Scanner input = new Scanner(System.in);
    		System.out.println("Please enter the number of families: ");
    		int numFam = input.nextInt();
    		int count = 0;
    		for(int x = 0;x<numFam;x++)
    		{
    			System.out.println("How many in this family?: ");
    			count = input.nextInt();
    			for(int y = 0;y<count;y++)
    			{
    				System.out.println("Enter a name: ");
    				q.offer(new String(input.nextLine()));
    			}
    			s.push((Queue)q);
    			q = new LinkedList<String>();
    		}
    		for(int z = 0;z<s.size();z++)
    		{
    			q = s.pop();
    			for(int w = 0;w<q.size();w++)
    			{
    				System.out.println(q.remove());
    			}
    			System.out.println();
    		}
    	}
    }


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Recompile with -Xlint problem, I've been able to fix it in the past but this time is difficult

    Recompile with -Xlint:unchecked for details.
    What did the details say?

  3. #3
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Recompile with -Xlint problem, I've been able to fix it in the past but this time is difficult

    I'm not sure. I don't even know where you would find those.

  4. #4
    Junior Member
    Join Date
    Nov 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Recompile with -Xlint problem, I've been able to fix it in the past but this time is difficult

    I've actually resolved the issue, the program gave me that error, but ran anyway. Thanks for trying anyway

  5. #5
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Recompile with -Xlint problem, I've been able to fix it in the past but this time is difficult

    Quote Originally Posted by lukestarchief View Post
    I've actually resolved the issue, the program gave me that error, but ran anyway. Thanks for trying anyway
    It looks like a warning more than an error. Programs with errors do not compile. You shouldn't ignore warnings either. Treat them like errors even though you can compile and run anyway. Get back in there and fix it. It is not quitting time yet.

Similar Threads

  1. difficult program
    By Fordy252 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: June 4th, 2014, 03:51 AM
  2. Difficult questions please help
    By javanoobieman in forum Other Programming Languages
    Replies: 7
    Last Post: February 17th, 2012, 05:49 PM
  3. what is -xlint message?
    By rush7610 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 21st, 2011, 10:36 PM
  4. HELP! Recompile with -Xlint:unchecked for details?????
    By polozelda in forum What's Wrong With My Code?
    Replies: 4
    Last Post: August 7th, 2011, 06:04 AM
  5. Need Help i cant fix this problem ...
    By mico332 in forum Member Introductions
    Replies: 3
    Last Post: March 18th, 2011, 06:12 PM