JAVA object-oriented basic questions and answers

  • Please write a brief to build a java step development environment and java cross-platform principle.

answer:

  1. Setup the development environment steps: 1. Download and install the JDK . 2. Configuring path path. 
  2. The Java : the principle of cross-platform java developed different versions for different platforms JVM , different platform installation on the corresponding version of the JVM after 
  3. Use java code written procedures compiled by a single byte code file , you can JVM to run a virtual machine 
  4. So just develop a set of use java programming code can be run on different platforms, this is java cross-platform principle.
  • int and Integer may represent an integer, both What is the difference in the use of it? Why JDK you want to design the two data types to represent the same data?

answer:

  1. Difference: int is a basic data type, and a package type Integer, Integer used to describe this type of data, there is a class constructor and general methods, which are int data type does not have features.

  2: Java existence of basic data types, but Java core idea is object-oriented programming, it also provides an important class for basic data types

 

  • What is Object-Oriented Programming 

answer:

  1. Object-oriented programming is that a project will be subdivided into a number of abstract classes first, to describe the project in a certain class of things,
  2. Then things in each category is given a number of specific characteristics allowed to become a specific object.
  3. By calling different approach is some connection between the object and the object in order to set up a system up and running
  4. Object-oriented programming is the idea.

Examples class  Object

Object- !       Template   -   copy

class Student{}    Student stu = new Student();

  •   Talk to your object-oriented characteristics [ three properties ] understood and illustrated. 

  A: The three major characteristics: encapsulation, inheritance, polymorphism.

  Packaging :

  1. Privatization field

    Provide setget method of assigning values

  2: a no-argument constructor (full javaBean )

    Meaning the package is to improve safety .

  2 Inheritance : There are fields and methods of access to inherit the parent class. Meaning: to improve the reusability of code.

  3 polymorphism:

  Parent child class type compatible. Animal aml = new Person (); shield subclasses compile time differentiation operation

  • Talk about your understanding of abstract classes and interfaces. 

  A: The abstract class:

  1. Use abstract modified class, class is never extracted from a common method,
  2. But the function of each class method implementations but different, so after other classes inherit this class must be abstract class method to overwrite.
  3. There may be a field general method of abstract class, which only supports single inheritance,
  4. This class can not create an object can not be instantiated.

  Interface: Interface , fields, and interfaces can not have an ordinary method, can not create object is instantiated, but the interface may be an interface to the plurality of inherited, inherited interfaces typically used to achieve a certain kind of function interfaces.

  • this and super difference 

  ( 1) the this represents the current object, the object holding the value of address

  (2) super behalf of the parent object, do not hold the address value

  (3) super reason will be in a subclass constructor, call the constructor of the parent class which is why the parent class's constructor will exist

  • Talk about recent Java Learning core idea 

  (1) a base portion

  ① computer command is mainly to process the data

  ② data types, data

  ③ execution process

  ④  a class + main methods, testing grammar

  (2) object-oriented portion

  ① computer command

  ② understanding of object-oriented thinking

  ③ around, classes and objects in object-oriented syntax

  ④ Data type   Value

  ⑤ execution process

 

Guess you like

Origin www.cnblogs.com/logoman/p/11241419.html