GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — think-in-java/4.7 练习.md at master · ycgithub77/think-in-java

Expand file tree

/

4.7 练习.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
13 lines (7 loc) · 835 Bytes
/

4.7 练习.md

Copy path

File metadata and controls

13 lines (7 loc) · 835 Bytes
Raw
Copy raw file
Download raw file
Edit and raw actions

4.7 练习

(1) 用默认构造器创建一个类(没有自变量),用它打印一条消息。创建属于这个类的一个对象。

(2) 在练习1的基础上增加一个重载的构造器,令其采用一个String自变量,并随同自己的消息打印出来。

(3) 以练习2创建的类为基础上,创建属于它的对象指针的一个数组,但不要实际创建对象并分配到数组里。运行程 序时,注意是否打印出来自构造器调用的初始化消息。

(4) 创建同指针数组联系起来的对象,最终完成练习3。

(5) 用自变量“before”,“after”和“none”运行程序,试验Garbage.java。重复这个操作,观察是否从输出中看出了一些固定的模式。改变代码,使System.runFinalization()在System.gc()之前调用,再观察结果。

You are visitor 01402860 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.