storagetest.java

来自「JAVA编程思想第四版英文原版习题答案. pdf原版的」· Java 代码 · 共 17 行

JAVA
17
字号
// object/StorageTest.java
// TIJ4 Chapter Object, Exercise 6, page 90
// Write a program that includes and calls the storage() method defined as a
// code fragment in this chapter.

public class StorageTest {	
	public static void main(String[] args) {
		class StoreStuff {
			int storage(String s) {
				return s.length() * 2;
			}	
		}
		StoreStuff x = new StoreStuff();
		System.out.println(x.storage("hi"));		
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?