staticimportdemo.java
来自「java编程代码」· Java 代码 · 共 30 行
JAVA
30 行
import java.util.Scanner;
import static java.lang.Character.toUpperCase;
//Alternatively, you can replace the above line with the following:
//import static java.lang.Character.*;
/**
Illustrate the use of a static method from the class Character.
*/
public class StaticImportDemo
{
public static void main(String[] args)
{
System.out.println("Enter a one line sentence:");
Scanner keyboard = new Scanner(System.in);
String sentence = keyboard.nextLine( );
sentence = sentence.toLowerCase( );
char firstCharacter = sentence.charAt(0);
sentence = toUpperCase(firstCharacter)
+ sentence.substring(1);
System.out.println("The revised sentence is:");
System.out.println(sentence);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?