inotgo.com


Tool version compatibility problem
Exception definition :
An event that interrupts the normal flow of a program , It's called an exception
Correct

This video is interpretive , So I hope you have read the content of this knowledge point , And after writing the corresponding code , Watch with questions , Only in this way can we gain more . It is not recommended to watch the video at the beginning



5 branch 43 second
This video uses html5 Play mode , If it cannot be played normally , Please upgrade your browser to the latest version , Recommend Firefox ,chrome,360 browser . If thunderbolt is installed , Play the video and show the direct download status , Please adjust Thunderbolt system settings - Basic settings - Start - Monitor all browsers ( Remove this option ). chrome of Video download Plug-in will affect playback , as IDM etc. , Please close or switch other browsers



Step 1 : There is no exception in the file   
Step 2 : practice - Abnormal   
Step 3 : answer - Abnormal   

Step 1 :

There is no exception in the file

edit top fracture
For example, to open d Of the disc LOL.exe File , This file may not exist
Java Through new FileInputStream(f) Trying to open a file , It's possible to throw There is no exception in the file FileNotFoundException
If the exception is not handled , There will be compilation errors
See... For solutions Exception handling
package exception; import java.io.File; import java.io.FileInputStream; public class TestException { public static void main(String[] args) { File f= new File("d:/LOL.exe"); // Trying to open file LOL.exe, Will throw FileNotFoundException, If the exception is not handled , There will be compilation errors new FileInputStream(f); } }
package exception;
 
import java.io.File;
import java.io.FileInputStream;
 
public class TestException {
 
    public static void main(String[] args) {
         
        File f= new File("d:/LOL.exe");
         
        // Trying to open file LOL.exe, Will throw FileNotFoundException, If the exception is not handled , There will be compilation errors 
        new FileInputStream(f);
         
    }
}
Step 2 :

practice - Abnormal

edit top fracture   Wrong posture , get half the results with double the effort ! Click to see the correct posture for the exercise
List your studies so far , What exceptions have you been exposed to , Under what circumstances
Before looking at the answers , Try to finish it yourself first , See the answer when you encounter a problem , The harvest will be more
Before looking at the answers , Try to finish it yourself first , See the answer when you encounter a problem , The harvest will be more
Before looking at the answers , Try to finish it yourself first , See the answer when you encounter a problem , The harvest will be more
Viewing this answer will cost 3 Points , You currently have a total of Point integral . It doesn't cost extra points to see the same answer . Points increase method Or One time purchase JAVA Intermediate total 0 One answer ( Total required 0 Integral )
Viewing this answer will cost 3 Points , You currently have a total of Point integral . It doesn't cost extra points to see the same answer . Points increase method Or One time purchase JAVA Intermediate total 0 One answer ( Total required 0 Integral )
Account not activated Account not activated , Limited functionality . Please click activate
This video is interpretive , So I hope you have read the content of this answer , Watch with questions , Only in this way can we gain more . It is not recommended to watch the video at the beginning

4 branch 2 second This video uses html5 Play mode , If it cannot be played normally , Please upgrade your browser to the latest version , Recommend Firefox ,chrome,360 browser . If thunderbolt is installed , Play the video and show the direct download status , Please adjust Thunderbolt system settings - Basic settings - Start - Monitor all browsers ( Remove this option ). chrome of Video download Plug-in will affect playback , as IDM etc. , Please close or switch other browsers


ParseException Parse exception , When a date string is converted to a date object , Possible exceptions thrown

OutOfIndexException Array subscript out of bounds exception
OutOfMemoryError Out of memory
ClassCastException Type conversion exception
ArithmeticException Divisor is zero
NullPointerException Null pointer exception


The official account of programming , Follow and get the latest tutorials and promotions in real time , thank you .


Q & A area    
2021-09-17 Why do I keep showing denial of access
2001110




Always show access denied , Permissions are open
 Loading
 
               
 
               


1 One answer

lt6868688
Answer time :2021-11-02
Because you're opening a folder , this new File(" Here is a file with full path , Not folders ")



The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see





2021-05-23 practice - Abnormal synthesis 2
Mono




// class : CheckingAccount checking account , Have overdraft limit , Inherit Account // attribute :overdraftProtection Overdraft limit
 Loading
public class Account {
	protected static double balance = 0.0d;
	protected double init;
	
	public Account(double init) {
		this.init = init;
	}
	
	public Account() {
		// TODO  Automatically generated constructor stub 
	}

	static Account x = new Account();
	
	public static double getBalance() throws overdraftException {
		if(balance < 0) 
			throw x.new overdraftException(" Overdraft exception ", balance);
		return balance;
	}
	
	public static void deposit(double amt) {
		balance = balance + amt;
	}
	
	public static void main(String[] args) {
		CheckingAccount y = x.new CheckingAccount();
		try {
			deposit(325.50);
			y.withdraw(415.50);
			y.CheckingAccount(balance); 
		} catch (overdraftException e){
			e.printStackTrace();
			System.out.println(e.getMessage() +"	" + e.getDeficit());
		}	
	}
	
	class overdraftException extends Exception {
		String message;
		double deficit;
		
		public overdraftException() {
			
		}
		
		public overdraftException(String msg) {
			super(msg);
			message = msg;
		}
		
		public overdraftException(String message, double deficit) {
			this.message = message;
			this.deficit = deficit;
		}
		
		public String getMessage() {
			return message;
		}
		
		public double getDeficit() {
			return deficit;
		}
	}
	
	class CheckingAccount extends Account {
		
		private double overdraftProtection;
		
		double protect;
		
		Account x = new Account();
		
		public double CheckingAccount(double balance) throws overdraftException {
			balance = x.getBalance();
			return balance;
		}
		
		public void CheckingAccount(double balance,double protect) {
			
		}
		
		public void withdraw(double amt) {
			balance = balance - amt;
		}
	}
	
}
 
               





The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see





2021-02-28 Tip package exception Don't match
2020-12-29 You catch FileNotFound Did you make any mistakes ?
2020-05-03 This is my summary


Too many questions , Page rendering is too slow , To speed up rendering , Only a few questions are displayed on this page at most . also 15 Previous questions , please Click to view

Please... Before asking questions land
The question has been submitted successfully , Auditing . Please My question Check the question record at , thank you
about JAVA Intermediate - Exception handling - What is an exception Your questions

Try to provide Screenshot code and Abnormal information , Help to analyze and solve problems . You can also enter this station QQ Group communication : 496725845
Ask questions and try to provide complete code , Environment description , The more conducive to the recurrence of the problem , The faster your question can be answered .
Have questions about the code in the tutorial , Please provide which step , Which line is in doubt , This makes it easy to quickly locate the problem , Improve the speed at which questions are answered
In the thousands of questions that already exist , A considerable proportion , Because of the use of and webmaster Different versions of the development environment Resulting in , For example jdk, eclpise, idea, mysql,tomcat Wait, the version of the software is inconsistent .
Please use the same version as the webmaster , You can save yourself a lot of learning time . The webmaster sorted out the software versions used in teaching , It's all here , Convenient for everyone to download : /k/helloworld/helloworld-version/1718.html

Upload screenshot