This article mainly introduces exceptions and packages in the basics of java. Friends in need can refer to it
1 Exceptions
Exception system
• Throwable
Error
# Usually major problems occur, such as: the running class does not exist or memory overflows, etc.
Do not write code to handle it
Occurs at runtime In this case, you can use try catch finally
The subclass names of Exception and Error are suffixed with the parent class name.
1.1 Methods in Throwable
##1.2 throws and throw
try { 需要检测的代码; } catch(异常类 变量) { 异常处理代码; } finally { 一定会执行的代码; }Finally code block will not be executed in only one case. It was System.exit(0) that was executed before. 1.4 Custom exceptionCustom class
Inherit Exception or its subclasses.
constructor .
Example:
Class DemoException extends Exception { DemoException(String message) { super(message); } }Throw a custom exception through throw.
1.5 Exception details
Category management of class files.
Provide multiple layers of
to classes.
is written on the first line of the program file.
The full name of the class name is package name.class name.
Package is also a form of encapsulation.
The class permissions in the accessed package must be public.
Member permissions in a class: public or protected
protected is a permission provided to subclasses in other packages
Routine
##3 import
4 Jar package
4.1 Operation of Jar package
Through jar. The operation of jar by exe tool.
jar -cvf mypack.jar packa packb
jar -tvf mypack.jar [>Directed file]
jar -xvf mypack.jar
jar –cvfm mypack.jar mf.txt packa packb
Java Free Video Tutorial
2. YMP Online Manual
3. Comprehensive analysis of Java annotations
The above is the detailed content of Summary of exceptions and packages during java development. For more information, please follow other related articles on the PHP Chinese website!

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version
Visual web development tools

Dreamweaver CS6
Visual web development tools