Recruits diary --- java syntax first experience

  Just finished a java grammar learning, and before learning c ++ to do some comparison.

 

  1. The main aspects of use 

     java server where to stay fit, suitable for back-end development, back-end Web in particular, there are a variety of mature framework, a sound ecological environment.

  Mobile phones, and so on large data field

 

    c ++ was originally thinking about doing GUI, and found that MFC has long been fading, GUI gradually scripted.

  c ++ for the bottom of the development, the field of high performance, such as background game server, game development, images, streaming video, engine, like the underlying communication

 

  2. Initial java syntax

    java grammar is simpler than c ++, provide a sound built-in classes, such as: String, StringBuffer.

    

    The greatest feeling is java discarded pointer.  

    c++:

     Both methods create objects, discussed explicitly create an object, the object is not returned

    (1) an object class (); if: Student stu ();

      Allocation function (method) stack area Student object, the object is a temporary object, lined with stu variable names, functions, namely the destruction of the end

     (2) = new Object class object; such as: Student * stu = new Student ();

      Student object allocated in the heap area with pointer identifying stu, the object is not destroyed automatically, the programmer need to decide when to destroy.

  

    java : 

    Student stu=new Student();

    All objects in the heap memory, the identifier identifies stu, this identifier is not a pointer, the pointer is a bottom, a reference data type, and the reference c ++ syntax similar, this identification Student object stored in the stack area

    Other objects can be identified: Student stu1 = new Student (); stu = stu1; stu steering stu1 of object identification, stu objects originally identified can not find it.

    Can not find do not worry, java released by the virtual machine memory, do not worry about memory management issues, so learning basic c / c ++ now seems very important, because the underlying pointer knowledge in order to better abstract

    

    String str="123";       

    "123" will implicitly creates a String object   

     str identify the object

      str="321";    

     str is not assigned, but rather to re-identify "321" objects;

    At this time, the original "123" object is not referenced, the virtual machine can be destroyed

 

    Array turned into a heap allocation, array types are reference types

   

 

    Today to learn so much, is my first blog, there may be many bad place to write, knowledge and understanding error, I will correct again in the future, and also welcome your comments and suggestions

Guess you like

Origin www.cnblogs.com/xiejianan/p/11331273.html