TBC
Structure of Java application:
1) Every application is a set of files/programs.
2) Every java application is a set of class files.
3) Every class file is a Model that represents Object.
4) JVM will run java application.
Every java application is mainly having 2 contexts:
1) Static context (free accessible area)
2) Non-static context ( restricted access/permissions required)
Class members :
1) Objects can be represented by classes only.
2) We need to write one class to define object.
3) Every instruction in java application must be placed inside the class.
4) All these following members allowed into a class.
Interface ->
Operations of an object are declared using Interface.
every object creation starts with interface & followed by class(implementation with class)
Implementation logic of object operations are provided using Class.
class provides
Compilation
lexical analysis phase-> buffering entire source code & separating it into tokens
annotation life time is upto runtime
We can access metadata using programmatically using annotations
Comments lifetime is upto source code, during compilation removed in lexical analysis phase.
Declarations
When memory is first allocated for an object, the data it contains is unpredictable. This can cause bizarre behavior. Java prevents this type of trouble by initializing variables to safe default values. The main steps to using a variable in Java are:
Declaration— Give the variable a name and a data type.
Instantiation— Allocate memory for the object.
Initialization— Assign the first value to the variable.
Declarations When memory is first allocated for an object, the data it contains is unpredictable. This can cause bizarre behavior. Java prevents this type of trouble by initializing variables to safe default values. The main steps to using a variable in Java are: ß Declaration— Give the variable a name and a data type. ß Instantiation— Allocate memory for the object. ß Initialization— Assign the first value to the variable. Declarations tell the compiler that you will be using a certain name to refer to a variable whose type is explicitly given. For basic data types (like int, for example), the compiler will reserve enough memory to hold the data. However, a declaration of an object reference type does not create an object; the declaration just adds the name to an internal list of names that Java knows will be holding objects, and it reserves enough space to hold a reference to an object. Instantiating an object allocates memory for it. For basic types, this happens automatically; for object types, your program must explicitly instantiate the object. Initializing places the first value in that object reference. Java has a shortcut for initializing variables that use primitive data types. You can do all three steps simultaneously, like so: int count = 243; The int count portion declared the variable and instantiated it as well. The = 243 portion initializes the new variable. We would say that this variable is initialized with an assignment statement upon declaration. Table 2.3 shows the instance and static variables' default values upon declaration.
Comments
Post a Comment