Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8747581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:22:48+00:00 2026-06-13T12:22:48+00:00

Is there a particular reason why this would happen or can it be for

  • 0

Is there a particular reason why this would happen or can it be for a lot of different reasons? I have no idea why my program is printing out the values that it is printing, because I was expecting it to print out integers. Instead I am getting this:

cycle@173a10f
cycle@a62fc3
cycle@a62fc3
cycle@a62fc3
cycle@530daa
cycle@a62fc3
cycle@a62fc3
cycle@530daa
cycle@a62fc3

This is part of the code: (I also have a cycle class, and a stack and queue class)

  import java.io.*;
   import java.util.*;

public class PrintQ {

  public static void main(String args[]) throws FileNotFoundException {

     Scanner inFile = new Scanner(new FileReader("C:\\Users\\Whitney\\Desktop\\QueueIn.txt"));
     String job1;
     job1=inFile.next();

     char char1;
     int i=0;
     int FirstComma;
     int SecondComma;
     String charholder;

     QueueClass<cycle> list= new QueueClass(100);
     QueueClass<Integer> cyclelist= new QueueClass(100);
     cycle currentcycle= new cycle();
     cycle priorityCycle= new cycle();
     cycle Scycle= new cycle();


     while(inFile.hasNext()){

        switch(job1.charAt(0)) {

           case 'q': 
              {
                 FirstComma=job1.indexOf(',');
                 SecondComma=job1.lastIndexOf(',');
                 currentcycle.jobNumber=Integer.parseInt(job1.substring(FirstComma+1,SecondComma));
                 currentcycle.cycleNumber=Integer.parseInt(job1.substring(SecondComma+1));
                 cyclelist.addQueue(currentcycle.cycleNumber);
                 list.addQueue(currentcycle);  
                 break;
              }

           case 'p': 
              {                    
                 FirstComma=job1.indexOf(',');
                 SecondComma=job1.lastIndexOf(',');
                 priorityCycle.jobNumber=Integer.parseInt(job1.substring(FirstComma+1,SecondComma));
                 priorityCycle.cycleNumber=Integer.parseInt(job1.substring(SecondComma+1));
                 cyclelist.addQueue(priorityCycle.cycleNumber);
                 list.priorityinsert(priorityCycle);
                 break;
              }

           case 's': 
              {
                 FirstComma=job1.indexOf(',');
                 SecondComma=job1.lastIndexOf(','); 
                 Scycle.cycleNumber=Integer.parseInt(job1.substring(SecondComma+1));
                 list.addQueue(Scycle);
                 cyclelist.addQueue(Scycle.cycleNumber);
                 break;
              }

           case 'h': 
              {
                 StackClass<Integer> stackjob= new StackClass();
                 StackClass<Integer> stackcycle= new StackClass();
                 job1=(String) inFile.next();

                 while(inFile.hasNext()){

                    switch(job1.charAt(0)) {

                       case 'q':
                          {
                             FirstComma=job1.indexOf(',');
                             SecondComma=job1.lastIndexOf(',');
                             currentcycle.jobNumber=Integer.parseInt(job1.substring(FirstComma+1,SecondComma));
                             currentcycle.cycleNumber=Integer.parseInt(job1.substring(SecondComma+1));
                             stackjob.push(currentcycle.jobNumber);
                             stackcycle.push(currentcycle.cycleNumber);
                             break;
                          }
                       case 'p':
                          {
                             FirstComma=job1.indexOf(',');
                             SecondComma=job1.lastIndexOf(',');
                             priorityCycle.jobNumber=Integer.parseInt(job1.substring(FirstComma+1,SecondComma));
                             priorityCycle.cycleNumber=Integer.parseInt(job1.substring(SecondComma+1));
                             stackjob.push(priorityCycle.jobNumber);
                             stackcycle.push(priorityCycle.cycleNumber);
                             break;
                          }

                       case 's':
                          {
                             FirstComma=job1.indexOf(',');
                             SecondComma=job1.lastIndexOf(',');
                             Scycle.cycleNumber=0;
                             Scycle.cycleNumber=Integer.parseInt(job1.substring(SecondComma+1));
                             stackjob.push(0);
                             stackcycle.push(Scycle.cycleNumber); 
                             break;
                          }

                       case 'h': 
                          {
                             continue;
                          }

                    }
                    job1=(String) inFile.next();

                 }   
                 System.out.println();
                 System.out.println();

                 while((stackjob.isEmptyStack()==false) && (stackcycle.isEmptyStack()==false)) 
                 {
                    int printjob;
                    int printcycle;
                    Object peek;

                    printjob=stackjob.peek();
                    printcycle=stackcycle.peek();
                    System.out.println("Job Number: "+printjob+" "+"Cycles Remaining: "+printcycle);
                    stackcycle.pop();
                    stackjob.pop(); 

                 } 

                 continue;
              }           
        }
        job1=inFile.next();   
     }   

     cycle whilecurrent= new cycle();

     while(list.isEmptyQueue()==false) 
     {
        whilecurrent=list.front();
        int whilecurrentcycle= cyclelist.front();
        list.print();
        //System.out.println();

        while(whilecurrentcycle != 0)
        {
           whilecurrentcycle--;
           //System.out.println("loop "+whilecurrentcycle);  
        }
        //System.out.println();
        //System.out.println(whilecurrent);

        cyclelist.deleteQueue();
        list.deleteQueue();   
     }  
     System.out.println();
     list.print();
     System.out.println(); 
  }

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:22:49+00:00Added an answer on June 13, 2026 at 12:22 pm

    Somewhere you’re printing cycle objects, and since you haven’t overridden cycle.toString(), it’s using the default toString implementation.

    To override the toString method of a class, you would need to write some code like below:

    class Xxx {
        @Override
        public String toString() {
             StringBuilder sb = new StringBuilder();
             sb.append("Your");
             sb.append("Logic Here");
             return sb.toString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any particular reason (other than it would make the parsing harder) that
Is there any particular reason that all data members in a class are private
Is there a particular way to initialize an IList<T> ? This does not seem
I have a WPF Windows application. In one window there is a particular stackpanel
I just had a case where it would have been really useful if there
Is there a particular reason why CSS 3D Transforms are not supported in Spotify
Is there a particular reason why you wouldn't use a natural identifier like an
Is there any particular reason why adding an item to an EF4.1 collection, saving
Is there any particular way to integrate Captch code validation in iPhone application? is
There is a very particular edge case in cross-domain policies regarding the window.top.Location object...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.