×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Creating objects according to the definition specified in the class defintion

本文发表在 rolia.net 枫下论坛Look at this:

Button b = new Button("OK");

This means we create a Button (a kind of object) according to the definition of java.awt.Button. The definition of the Button is saved in the Button.class in java.awt package.

Whenever we create an Object, we need to pre-define a class. Otherwise, how do you create an Object? what will your Obejct look like? Like a cat, or like a pile of bullshit? -):

SOMETIMES, people need to create an Object. As they set about this task, they found they have not yet established the model (pre-defined the class). Some guys are very casual. Let me say they are now working in
a class. They take the following approach:
Define the class right there, and use that class definition to create an Object immediately. Some guys even combine these two steps together! Because this class
definition is written within another class definition, so it is called inner class.

Originally, the inner class is for casual, or lazy guys. As the time flows, you will find Inner class is an elegant approach in Java.
For a Java guy, it is a common practice to use inner class.更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / Jabber,I'm reading thinking in java now.The inner class make me very confused.Could you give me some clue of it?thank you.
    • Creating objects according to the definition specified in the class defintion
      本文发表在 rolia.net 枫下论坛Look at this:

      Button b = new Button("OK");

      This means we create a Button (a kind of object) according to the definition of java.awt.Button. The definition of the Button is saved in the Button.class in java.awt package.

      Whenever we create an Object, we need to pre-define a class. Otherwise, how do you create an Object? what will your Obejct look like? Like a cat, or like a pile of bullshit? -):

      SOMETIMES, people need to create an Object. As they set about this task, they found they have not yet established the model (pre-defined the class). Some guys are very casual. Let me say they are now working in
      a class. They take the following approach:
      Define the class right there, and use that class definition to create an Object immediately. Some guys even combine these two steps together! Because this class
      definition is written within another class definition, so it is called inner class.

      Originally, the inner class is for casual, or lazy guys. As the time flows, you will find Inner class is an elegant approach in Java.
      For a Java guy, it is a common practice to use inner class.更多精彩文章及讨论,请光临枫下论坛 rolia.net