This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Hi, We are required to use netbeans for Intro to Programming with Java. However, once I have compiled a working program, and I click Run -> Run File -> Run "***.java", nothing happens if I use the System.out.print feature. The program will work if I use System.out.println() feature, but does not go to the next line of code if I just use System.out.print. When I do try to run it, it just sais : "init: deps-jar: compile-single: run-single:" However, when changing it to println(), everything works fine. Any help is appreciated! -Alex Here's the code: package stateexam; import java.util.*; import java.io.*; public class StateExam { public static void main(String[] args) throws IOException { String stateName1; String stateName2; double population1; double population2; double averagePop; Scanner input = new Scanner(System.in); System.out.print("What is the name of the first state?: "); stateName1 = input.nextLine(); System.out.print("What is the name of the second state?: "); stateName2 = input.nextLine(); System.out.print("First state's population?: "); population1 = input.nextDouble(); System.out.print("Second state's population?: "); population2 = input.nextDouble(); averagePop = (double) (population1 + population2) / 2; System.out.print("The average population of " + stateName1 + " and " + stateName2 + " is " + averagePop); } }
Print category is for Print and Print Preview actions only. Reassigning to the right category.
AFAIK, the PrintStream caches data written by "print" method (so it is not required to actually send the data out until flushed). Try to use System.out.flush(). See java.io.PrintStream for more information.