我是Java新手,不知道如何像这样格式化我的代码:字体" Courier New "字体大小" 9 "加粗
我正在尝试格式化整个段落的文本。我真的很感激你的帮助。提前感谢!
下面是我的代码:public class H_1
{
//--------------------------------------------------------------------
// main
//--------------------------------------------------------------------
public static void main (String[] args)
{
Graphics
// Declare variables
// int someInt;
// double someReal;
// String someString;
Scanner keyboard = new Scanner(System.in); // Connect to keyboard
// Show application header
System.out.println("Welcome to my Application!");
System.out.println("--------------------------n");
// Display output
System.out.println("I'm singing in the rain");
System.out.println("Just singing in the rain");
System.out.println("What a glorious feelin'");
System.out.println("I'm happy again n");
System.out.println("I'm laughing at clouds");
System.out.println("So dark up above");
System.out.println("The sun's in my heart");
System.out.println("And I'm ready for love n");
System.out.println("I walk down the lane");
System.out.println("With a happy refrain");
System.out.println("Just singin',");
System.out.println("Singin' in the rain");
// keyboard.nextInt() reads token from keyboard and converts to whole number
// keyboard.nextDouble() reads token from keyboard and converts to real number
// keyboard.next() reads token from keyboard
// keyboard.nextLine() reads line from keyboard through end-of-line character
// Close keyboard
keyboard.close();
// Show application close
System.out.println("nEnd of my Application");
}
}
你的问题不清楚,但因为没有太多的选项可以回答,所以让我们继续吧:
- 如果你真的在问如何格式化你的源代码;那么您必须转向您正在使用的编辑器/IDE的首选项。任何有意义的工具都允许您更改源代码的字体/大小/系列。
- 如果你在问如何"格式化"你的java编程打印的东西;这是一个非常不同的故事。本质上:java控制台只是打印文本;如果不使用特殊的库,你就不能在那里进行任何格式化。
编辑;当您专注于"打印输出"时:您的代码正在写入控制台。这意味着你的选择是有限的。所以:咨询那个链接,看看是否有什么有用的东西。
最后:如果这是关于为你的作业创建一个纸质打印 -考虑将你的java程序的输出复制到你最喜欢的"office"程序中,在打印之前格式化它。