📄 fruit.java
字号:
import java.io.IOException; // For code that delays ending the program
public class Fruit
{
public static void main(String[] args)
{
// Declare and initialize three variables
int numOranges = 5; // Count of oranges
int numApples = 10; // Count of apples
int numFruit = 0; // Count of fruit
numFruit = numOranges + numApples; // Calculate the total fruit count
// Display the result
System.out.println("A totally fruity program");
System.out.println("Total fruit is " + numFruit
+ " and oranges = " + numOranges);
// Code to delay ending the program
System.out.println("(press Enter to exit)");
try
{
System.in.read(); // Read some input from the keyboard
}
catch (IOException e) // Catch the input exception
{
return; // and just return
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -