Java learning experience sharing
Programming Thoughts
API documentation is very important! ! !
While thinking and writing, I will have a lot of ideas.
Frequently printing something is very helpful for debugging the program.
Check the API documentation more, type the code more, and type after you understand it.
Memorizing is a good way to study with high intensity in a short period of time.
Keep the example program well. If you need to use it in the future, check the API and write it according to the writing method of the example program.
Three points support your development: technology, management and communication.
In this question, what are the classes and objects
What properties should the classes and objects have and methods
What is the relationship between classes and classes
Create methods
Methods Name
Parameters of method
Return value of method
Memory
Understand how memory, stack, heap, data seg, and code run
Package and import
package com.bjsxt.java140;//1. The company’s domain name is reversed Come over, followed by the project name, etc.
public class Cat {
}
public class Dog {
public static void main(String[] args) {
com.bjsxt.java140.Cat c = new com.bjsxt.java140.Cat();//2. The compiled class must be located in the correct directory
}
}
import com.bjsxt.java140.Cat; //3. Import package
public class Dog {
public static void main(String[] args) {
Cat c = new Cat() ;//4. Abbreviation
}
}
***
Override (override/overwrite)
When rewriting the method, copy, do not type the wrong method name.
Inheritance
private
default
protected
public
class can only be a constructor in public and default
inheritance
During the construction process of the subclassmustcall the construction method of the parent class once
The subclass uses super(arguments list) in its own construction method to call the parent class Constructor method
Use this(arguments list) to call other constructor methods of this class
If super is called, it must be written in the subclass The first line of the construction method
Polymorphism (polymophysm)
Three necessary conditions for the existence of polymorphism:
There must be inheritance
There must be overriding
The parent class reference points to the child class object
Exception handling (errors that occur during runtime)
It is important to observe the name and line number of the error
Be able to handle it Those that cannot be processed must be thrown (throws Exception)
5 Keywords: try, catch, finally, throws, throw
Catch the small one first, then the big one
Rewrite method, The exceptions thrown must be consistent or not thrown
Array
Allocate space first, then load the array
a = new int[3];//Allocate space
a[0] = 1; a[2] = 5;a[3] = 7;date days[ ];//Declare the array nameGenericdays = new date[3];//Allocate space
days[0] = new date(1, 4, 2017);
days[1] = new date (2, 4, 2017);
days[2] = new date(3, 4, 2017);
Container
Generic➕ Automatic packaging and unboxing (auto-boxing&unboxing) can omit forced conversion
IO
Input stream
Output stream
Byte stream
Character stream
-
Node stream
Processing flow
Thread
Definition: different execution paths in a program.
Process is a static concept, and threads are actually running in the machine.
At the same point in time, a CPU can only support one thread executing.
If you can use the interface, don't inherit from the Thread class. This will be more flexible.
synchronized, when this method is executed, the current object is locked.
network programming
The above is the detailed content of Java learning experience sharing. For more information, please follow other related articles on the PHP Chinese website!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Square Root in Java. Here we discuss how Square Root works in Java with example and its code implementation respectively.

Guide to Perfect Number in Java. Here we discuss the Definition, How to check Perfect number in Java?, examples with code implementation.

Guide to Random Number Generator in Java. Here we discuss Functions in Java with examples and two different Generators with ther examples.

Guide to Weka in Java. Here we discuss the Introduction, how to use weka java, the type of platform, and advantages with examples.

Guide to Smith Number in Java. Here we discuss the Definition, How to check smith number in Java? example with code implementation.

In this article, we have kept the most asked Java Spring Interview Questions with their detailed answers. So that you can crack the interview.

Java 8 introduces the Stream API, providing a powerful and expressive way to process data collections. However, a common question when using Stream is: How to break or return from a forEach operation? Traditional loops allow for early interruption or return, but Stream's forEach method does not directly support this method. This article will explain the reasons and explore alternative methods for implementing premature termination in Stream processing systems. Further reading: Java Stream API improvements Understand Stream forEach The forEach method is a terminal operation that performs one operation on each element in the Stream. Its design intention is

Guide to TimeStamp to Date in Java. Here we also discuss the introduction and how to convert timestamp to date in java along with examples.
