Java Surface Question-java Foundation

Source: Internet
Author: User
Tags naming convention windows support

What are the advantages and disadvantages of 1.1java compared to other languages?

First of all, Java is a completely object-facing language compared to C, C + +, although his underlying (runtime library) is developed using C, but does not depend on C, because Java runs in the runtime library support, so the operation efficiency can be closer to the bottom of C, C + + Efficiency will have an impact, but Java class Library with a good design concept, very easy to use, the page is very practical, has become a standard development language in the industry, his cross-platform features received the favor of developers, only need to develop once in all the Java Runtime Library installed in the environment to run.

Second, compared to Java and C #, C # is a programming language developed by Microsoft, syntax similar to Java, almost a copy of Java, operating principle and Java is similar, but also through the runtime library support run, but the platform is limited, Java almost all platform support, two C # Currently only supported by Windows and Linu West, Windows support is of course developed by Microsoft itself, two Linux support is supported by mono, in fact, Mono is also the C # application into Java applications, so in essence, C # is still supported only by Microsoft's own operating system. Application platform is limited, is the biggest disadvantage.

1.2 Please answer the meaning of several nouns, JVM,JDK,JRE,JAVASE,JAVAEE,JAVAME,GC

Jvm:java virtual machines, Java Virtual machine abbreviation, is a fictitious computer, through the actual computer simulation of a variety of computer functions to achieve, Java VM has its own perfect hardware architecture, such as processors, stacks, registers, etc., also has the corresponding instruction system, the JVM shields the information which is related to the operation system platform, the Java program only generates the target code (bytecode) which runs on the Java Virtual machine, can run without modification on the various platforms.

Jdk:java Development Kit, abbreviation for Java Development Kit. The JDK is the core of the entire Java, including the Java Runtime environment. Java tools and Java core class libraries.

Jre:java runtime Environment, Java Runtime Environment abbreviation, run Java program must set of environment, including JVM standard implementation and Java and Hing Class library.

Javase:java standardedition, Standard Edition, is a commonly used version, from jdk1.5 began to rename the Javase, mainly for the desktop application software programming;

Javaee;java Enterprise Edition, Business Edition, Java EE is a new name for the EE, mainly for the development of distributed network programs.

Me:java Micro Editon. Embedded consumer electronic devices such as set-top boxes, mobile phones and PDAs provide the Java language platform, including virtual machines and a range of standardized javaapi.

GC: Garbage collection, garbage collection abbreviation. When a Java virtual machine discovers memory tension, it automatically cleans up memory space consumed by useless objects (objects not applied to them).

1.3JVM can have several examples

Each Java program corresponds to a JVM instance, and when a Java program runs it creates a JVM instance, so the number of instances of the JVM depends on the number of programs that the colleague executes.

How the 1.4java cross-platform is implemented.

Java is implemented using the JVM. Java source code, the Java compiler has been mutated into Java bytecode. Class, execute Java bytecode, Javaz bytes are interpreted by the JVM as specific platform specific instructions and executed, different platforms have different JVMs, the mainstream platform provides the JVM, so Java bytecode can be interpreted on the mainstream platform to perform. This means that Java bytecode is cross-platform.

1.5 Brief description of the differences between TCP,UDP protocols

TCP: Connection-oriented reliable transmission of large amounts of data slow UDP: For non-connected unreliable small amounts of data fast

1.6 Class naming convention, method of the name of the meter rule, variable naming, package, constant naming specification,

In Java, the naming conventions for Java identifiers are first met:

1 can be composed of letters, numbers, underscores, and $

2 initials cannot begin with a number 3 Chinese can be used as a variable name, but not 4 Java case-sensitive keyword 5 cannot use Java reserved keywords

Second, class naming: Capitalize the first letter, how to compose multiple letters, and capitalize the first letter of each word.

Method Name: The first letter lowercase, each word in the middle of the first letter is capitalized;

Variable: The same as the method;

Package: The name of the Java package is made up of lowercase words, usually the domain name on the Internet as the unique prefix of the package.

Constants: Constant name of the basic data type dog capital, if more than one word composition, can be separated by writing lines;

1.7 A few ways to annotate Java

Three types of single-line comment Multiline Comment document comments

1.8 How to increase the clarity and considerable code;

Code add comment Naming specification Indentation typographic specification adding exception handling using Test classes and test methods

1.9 void and NULL, have you what difference;

Void is used for methods with no return value to represent an object, the variable is not instantiated, and there is no ambition for a specific memory address

1.10 Java Structured Programming What are the three basic processes that correspond to those statements

Sequence, selection, loop, which, in sequence, indicates that an operation in the program is performed in the order in which the installation occurs, selects the corresponding if witch, loops the for dowhile in the Java language, and the while

1.11 &he && Difference

& when the logical expression is all calculated,&& operation has short-circuit calculation function, the so-called short-circuit calculation, refers to the system from left to right logical expression calculation, once the calculation results have been determined, the calculation process is terminated

1.12 Eight data types and byte lengths in Java

BYTE eight bits store one byte of data short 2 byte 16 bit compatibility consider generally not int 4 byte 32 bit storage integer long 8 byte 64 bit store long integer float four byte 32 bit store floating point number

Double 8-byte 64-bit storage dual-precision floating-point number char 2-byte 16-bit store one character Boolean byte 8-bit store logical variable true false

1.13 How the JVM loads the class file

The loading of classes in the JVM is implemented by ClassLoader and his subclasses, Java ClassLoader is an important Java Runtime system component that is responsible for locating and loading classes in class files at run time

1.15 What is a process

A process is the basis of an operating system structure, an instance of a running program in a computer, an entity that can be assigned to a processor and executed by the processor, displayed by a single order of execution, a current state, and a group of related system resources described by the active unit.

1.16 What is garbage collection, when to start, how to reduce the frequency of garbage collection, he can ensure that the program has enough memory available;

1 Garbage Collection GC is an important feature of the Java language that frees up memory that is not in use

2 garbage collection is managed by the system and automatically initiates a thread to wake up when the system deems it necessary;

3 Minimizing the amount of garbage memory and the number of new objects in time can reduce the frequency of garbage collection

4 garbage collection mechanism Unable to save enough memory

1.17 Java Memory leaks

In both cases 1 of the allocated memory in the heap, when it is not released, all the way to access this memory is deleted 2 in the Memory object is no longer necessary, but also preserves the memory and his access mode

1.18 If you can include more than one class in a Java source file, what are the limitations

A Java source file can contain more than one class, and a public word must be the same as this name, no public word can do with anything. A Java source file contains a Java class

1.18 List your favorite JDK packages

1.java. Lang This package contains the base classes provided by the JDK. Like string technician is here. This package is the only package that can be used without importing

2.java.io contains classes such as file operations related to input and output.

3 java. NET contains network-related classes, such as URL urlconnection, etc.

4 Javautil This is the system helper class, especially the collection class collection list map

5 classes for Java SQL Database Operations Connection statement resultset

1.19 Simple description of what is recursive and what happens when you use Java implementation

1 recursion as an algorithm is widely used in programming language, it is the re-entry phenomenon that the function process subroutine directly or indirectly invokes itself in the process of running.

2 recursive algorithms are generally used to solve three kinds of problems

The definition of the data is based on the recursive definition of the structure of the data implemented by the recursive algorithm is defined recursively.

1.20 sorting in Java

Insert Sort Interchange Sort Select Sort Merge sort Assign sort

Java Surface Question-java Foundation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.