Topic: 新手SOS

  Print this page

1.新手SOS Copy to clipboard
Posted by: zknick0089
Posted on: 2005-02-18 17:01

我想打印3行4列的“X”矩形,以下程序哪儿错了?
class test
{
public static void main(String args[])
{
  for (int i = 0; i<3; i++)
  {
    for (int j = 0; j<4; j++)
    {
      System.out.println ('x');
    }
    System.out.println ();
  }
}  
}

2.Re:新手SOS [Re: zknick0089] Copy to clipboard
Posted by: bluepure
Posted on: 2005-02-18 17:13

class test
{
public static void main(String args[])
{
for (int i = 0; i<3; i++)
{
for (int j = 0; j<4; j++)
{
System.out.print ('x');//这里不换行。
}
System.out.println ();
}
}
}

3.Re:新手SOS [Re: zknick0089] Copy to clipboard
Posted by: jakiey
Posted on: 2005-03-24 08:08

print()是输出后不换行,而println()是输出后换行。

注意其区别噢!


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923