Questions tagged [println]

In programming, `println` generally prints out the arguments given, then moves to a new line for subsequent output.

In programming, println generally outputs the arguments supplied, then moves to a new line for any further output operations. For example, in Java you could write the following:

System.out.print("Hello ");
System.out.println("World");
System.out.println("Goodbye");

And the console would output (with \n representing newline characters):

Hello World\n
Goodbye\n

There are several languages that use the println() method; Others have different syntax that accomplishes the same functionality.

617 questions
2
votes
1 answer

physicsWorld.bodyAlongRayStart() creating phantom println (reads 'Chance') - override println function?

I'm using Sprite Kit's built-in physics engine in a game I'm writing. In order to check whether or not a character is on the ground, I'm using the bodyAlongRayStart() function of the SKScene's physicsWorld to check for bodies underneath the…
MassivePenguin
  • 3,701
  • 4
  • 24
  • 46
2
votes
1 answer

Println and String Concatention issue

I have a strange behavior within swift playground. When I enter this lines of code println("test 1" + "test 2" + "test 3" + "test 4") //compiles println("test 1" + "test 2" + "test 3" + "test 4" + "test 5") //compiles println("test 1" + "test 2" +…
nemke
  • 2,440
  • 3
  • 37
  • 57
2
votes
1 answer

ItemListener println double output

jbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { for (int x = 0; x < string.length; x++) { if (jbox.getSelectedItem() == string[x]) { …
roboticonx8
  • 39
  • 1
  • 11
2
votes
4 answers

Change size of font System.out.println

Can you tell me how to increase the size of the font using System.out.println in java.
Pedro Piloto
  • 169
  • 1
  • 2
  • 5
2
votes
1 answer

FileWriter and PrintWriter won't output to file

I have this code public User createnewproflie() throws IOException { FileWriter fwriter = new FileWriter("users.txt",true); //creates new obj that permits to append text to existing file PrintWriter userfile = new PrintWriter(fwriter);…
2
votes
3 answers

I need to make a triforce containing 3 lines of number for each triangle

Each line is the same number and in all three triangles the number is the same. Input: The first line contains an integer n that represents the number of data sets to follow. Each data set will consist of 1 integer m that represents the number…
Rexhep
  • 51
  • 1
  • 4
2
votes
1 answer

calling golang println with variable arguments

I have the following code to print n lines for debug purposes. output() prints the address of args instead of the parameters. How to fix it ? var outputMax = 10 var outputCnt = 0 func output(args ...interface{}) { outputCnt++ if(outputCnt <…
satish
  • 329
  • 2
  • 11
2
votes
2 answers

Odd thing when deal with goroutine

There are two odd things. I made 1000 numbers in slice but it just print 246,why 246?and why not 1000? if I delete "log.Println("hey")"this line,why does it just print 0? I know it may has sync problem,but i haven't write any concurrence programs…
Max Lau
  • 35
  • 2
2
votes
2 answers

print double number in java and get wrong answer

double check =0.615 * 255 -0.515 * 255 -0.100 * 255; System.out.println(check); why get -2.8421709430404007E-14? it should be 0.0
Rebecca
  • 111
  • 2
  • 12
2
votes
2 answers

I would like to print a graph, but i've printed it upside down. Why?

My program filled an integer array with numbers, I've called it count array: int[] array count = {5, 4, 3, 0}; Now i want to print my array grapically horizontally using for loop(s). I want to print all my values in asteriks, an example would be: …
swennemen
  • 945
  • 1
  • 14
  • 24
2
votes
4 answers

Java program error with tostring

So I'm trying to create a program that When you enter 4 arguments through command line such as 1 2 3 4. It outputs: java TestRect 1 2 3 4 rectangle = (1.0, 2.0, 3.0, 4.0) area = 12.0 perimeter = 14.0 Here is what I have so far: public class…
user2681595
  • 97
  • 1
  • 4
2
votes
1 answer

Java (Eclim + Vim) "system.out.print" not working

I am new to Java programming, and today while messing with eclim and vim, I discovered that the System.out.println(); function is not working. class apples{ public static void main(String args[]){ double tuna = 5.28; …
Rahatzi
  • 43
  • 5
2
votes
4 answers

Using scanner to get input not printing as expected

This is for a friend of mine who is having trouble with Java for school. I do know some programming, but not Java. Scanner kbReader = new Scanner(System.in); System.out.print("Name of item: "); String name =…
user
  • 16,429
  • 28
  • 80
  • 97
2
votes
3 answers

Redirect lots of system.out.println's to a .txt file

Possible Duplicate: Print java output to a file In a Java program, I have a long method, (which I don't think is important to post since it's not vital to the question) that has a large number of println statements to print status updates to the…
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
2
votes
2 answers

Getting println error in Eclipse

I'm beginning programming with Java, and it seems Eclipse is giving me errors from day one. Here's my hello, world program: public class HelloWorld { public static void main(String args[]) { System.out.println(“Hello, World!”); …
Jules
  • 14,200
  • 13
  • 56
  • 101