Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Don't show println() in console
Don't show println() in console [message #1710028] Fri, 02 October 2015 18:26 Go to next message
Andrey Programmer is currently offline Andrey ProgrammerFriend
Messages: 2
Registered: October 2015
Junior Member
Hi all

I'm just start learning java and met the following problem:

in my program I have only one method main (String[] args) and when I make another part of program in {}, it doesn't show the result in console
Here is it's part:

import static java.lang.System.out;

import static java.lang.System.out;
import java.util.Date;
import java.util.Scanner;

public class Program {



public static void main(String[] args)

{
String s1 = "Привет";
String s2 = new String("Привет");

String hello = "Привет";
String name = "Андрей";
String result = hello + ", " + name.toUpperCase();
out.println(result);

char ch = s1.charAt(0);

out.println(s1);
out.println(ch);

/*
// VERY BAD
String r = "";
for(int i=1; i <=100; i++)
r += String.valueOf(i)+ " ";

out.println(r);

*/

StringBuilder sb = new StringBuilder ();
for(int i=1; i <=100; i++)
sb.append(i).append(" ");

String r = sb.toString();

out.println(sb);
/*
Scanner sc = new Scanner (System.in);
out.print("Введите строку:");
String s = sc.nextLine();


String s3 = "Andrey";

out.println(s);


boolean rs = (s.equals(s3));
out.println(rs);
*/
}

/* from this line nothing is shown in console and in "Outline" these parts are marked as red squares.
{
String s1 = "Привет";
String s2 = "Привет";

Boolean r = (s1 == s2);

out.println(r);

}

{

int a = 5;
int b = 7;

out.printf("a = %d\nb = %d\n", a, b);

double d = 5D/2;

out.printf ("d=%f", d);

}

{
Date now = new Date();

out.printf("%1$tY-%1$tB - %1tD", now);

}
}

Please, help me to solve this problem.
Thank you.
  • Attachment: Untitled.png
    (Size: 85.21KB, Downloaded 128 times)
Re: Don't show println() in console [message #1710044 is a reply to message #1710028] Sat, 03 October 2015 05:44 Go to previous messageGo to next message
Nitin Dahyabhai is currently online Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

This isn't a general programming forum, it's one for questions about using Eclipse. http://www.javaranch.com/ is one of many places for the kind of question you've asked.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Don't show println() in console [message #1710051 is a reply to message #1710044] Sat, 03 October 2015 11:06 Go to previous messageGo to next message
Andrey Programmer is currently offline Andrey ProgrammerFriend
Messages: 2
Registered: October 2015
Junior Member
OK, thank you!
Re: Don't show println() in console [message #1711014 is a reply to message #1710051] Mon, 12 October 2015 11:11 Go to previous message
Joshua Miller is currently offline Joshua MillerFriend
Messages: 1
Registered: October 2015
Junior Member
Perhaps it's because you missed System from System.out.println();
Previous Topic:I am a newbe
Next Topic:Eclipse is stuck.
Goto Forum:
  


Current Time: Thu Apr 25 19:34:45 GMT 2024

Powered by FUDForum. Page generated in 0.08451 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top