1:java variable parameters?
The number of arguments is indeterminate, but the type is determined;
The variable parameter is in the last item and only one variable parameter is supported:
Public void funciton1 (int A, string ... args) { for(string B:args) { System.out.print (b); } }
2: Run-time exception VS non-run-time exception?
The main difference is that a non-runtime exception must be displayed in the code for a claim capture that is placed in the Try{}catch () {} block, or declared throws on the method to throw an exception, and the type belongs to the exception class and its subclasses.
Run-time exceptions do not need to be specifically stated, the General runtime exception is the virtual machine problems will be reported, such as you write a dead loop caused by memory, and run-time exceptions are RuntimeException class and its subclasses, such as Nullpointerexcetpion, Indexoutofboundsexcrtiption, etc., the program can not be captured. It is usually caused by logic and should be avoided as much as possible.
R The untimeexception class is a subclass of the exception class, which is called a run-time exception, and all runtime exceptions in Java are inherited directly or indirectly from the RuntimeException class.
Exceptions in Java that inherit from exception and do not inherit from the RuntimeException class are non-runtime exceptions .
3: What is abnormal loss?
The old exception is lost when code that handles the exception throws a new exception after the exception is thrown.
4: Two ways of exception handling?
Capture processing with try {} catch{} finally {}, throws excepltion after the function, throws an exception, and the function internal throw new Exception ().
5: How do I customize exceptions?
Inherit exception or its subclasses (such as RuntimeException).
6:try statement block has return, will execute finally? If there is a return before executing try{}, will the finally execute?
If there is a return in the try, the code in finally will be executed first, and if it is sytem.exit (0), then finally is not executed;
If there is a return before the try, finally is not executed.
An exception match in 7:catch?
The base class catches the derived class exception. Catch, it matches the derived class first, and then the base class.
The difference between 8:throwable, Error, Exception, runtimeexception?
(1) The Throwable class is a superclass of all errors or exceptions in the Java language. Its two sub-classes are error and exception;
(2) error is a subclass of Throwable that indicates a serious problem that a reasonable application should not attempt to capture. Most of these errors are abnormal conditions;
(3) The exception class and its subclasses are a form of throwable, which points out the conditions that a reasonable application wants to capture;
(4) RuntimeException is a superclass of exceptions that may be thrown during the normal operation of a Java virtual machine.
Any subclass of RuntimeException that may have been thrown but not captured during the execution of the method does not need to be declared in the throws clause. It is a subclass of exception;
9: Memory Overflow:
There is too much memory in the application system that cannot be reclaimed or used, resulting in more memory being run by the program than the maximum memory provided by the virtual function.
Reason:
(1) The amount of data loaded in memory is too large, such as to remove too much data from the database at once, such as with the database lock table;
(2) There are dead loops or loops in the code that produce too many duplicate object entities;
(3) Start parameter memory value setting is too small;
Solve:
(1) is to modify the JVM startup parameters, directly increase memory;
(2) Check the error log;
(3) Use the memory viewing tool to dynamically view memory usage;
JAVA Programming thought three