Results 1 to 2 of 2
  1. #1
    ruick78 is offline Member
    Join Date
    Sep 2016
    Posts
    2
    Rep Power
    0

    Default Prints out only in eclipses console.

    i have few programs that keep printing out [which work] in the Console of eclipse when needing it to get into a pop up box i think what i want call it.
    this program does what i want it to do with pop up box
    Java Code:
    import acm.program.*;
    public class bottles extends ConsoleProgram {
    	public void run() {
    		int num = 100;
    		int i = 1;
    		while ( num >= 0){
    			println(" "+num+" bottles of beer on the wall.");
    			println(" "+num+"bottles of beer.");
    			println("You take one down, pass it around.");
    			int nums = num - i;
    			num=nums;
    		}
    	}
    }
    but then i have a program like this one that dosn't do it. I can't figure out why.
    Java Code:
    import java.util.Scanner;
    import acm.program.ConsoleProgram;
     
    class ReverseNumber extends ConsoleProgram
    {
       public static void main(String args[])
       {
          int n, reverse = 0;
     
          System.out.println("Enter the number to reverse");
          Scanner in = new Scanner(System.in);
          n = in.nextInt();
     
          while( n != 0 )
          {
              reverse = reverse * 10;
              reverse = reverse + n%10;
              n = n/10;
          }
     
          System.out.println("Reverse of entered number is "+reverse);
       }
    }

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Prints out only in eclipses console.

    Perhaps the difference is println vs System.out.println.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Exceptions prints all weird -_-
    By HelpingIsCaring in forum New To Java
    Replies: 24
    Last Post: 08-05-2013, 02:55 PM
  2. Array prints line 2x
    By Cinnic in forum New To Java
    Replies: 6
    Last Post: 07-14-2013, 03:22 PM
  3. Txt to ArrayList only prints []
    By Quasi Urbane in forum New To Java
    Replies: 4
    Last Post: 04-27-2011, 07:16 PM
  4. Canvas Prints
    By canvas02 in forum Reviews / Advertising
    Replies: 0
    Last Post: 02-18-2011, 05:33 PM
  5. Count each cell as it prints.
    By Shyamz1 in forum New To Java
    Replies: 9
    Last Post: 10-29-2010, 12:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •