current location:Home > Technical Articles > Java > JavaBase
- Direction:
- All web3.0 Backend Development Web Front-end Database Operation and Maintenance Development Tools PHP Framework Daily Programming WeChat Applet Common Problem Other Tech CMS Tutorial Java System Tutorial Computer Tutorials Hardware Tutorial Mobile Tutorial Software Tutorial Mobile Game Tutorial
- Classify:
-
- How to determine whether a file exists in java and create a new file if it does not exist
- In "java", the method to determine whether a file exists or create a new file if it does not exist is: first save the file path to a file object, and then use the "exists()" method to determine whether the file exists. If it does not exist, use "createNewFile() )" method to create a new file.
- JavaBase 6122 2019-11-25 10:10:55
-
- Summary of file downloading and garbled file names in Java
- Garbled java download file names can be solved by setting the file name encoding when downloading. In IE browser, you can use the encode() method to specify the encoding format. Files in Java can be downloaded in the form of streams, and files can be read using the FileInputStream method.
- JavaBase 3490 2019-11-25 10:08:28
-
- The difference between expressions i++ and ++i in java
- The difference between the expressions "i++" and "++i" in "java" is: "i++" means assigning a value first and then incrementing; "++i" means incrementing first and then assigning a value. For example: "j=i++" means that the variable "i" is first assigned to the variable "j" and then increments; "j=++i" means that the variable "i" is first incremented and then the variable is assigned a value.
- JavaBase 3452 2019-11-25 09:59:38
-
- Reasons and solutions for garbled Chinese characters in Java
- Java Chinese characters are garbled because the default encoding method in Java is different from the Chinese character encoding method. We only need to convert the encoding format when outputting Chinese characters and reading Chinese characters from parameters. You can use String(str.getBytes("Encoding" ),"encoding"); statement changes the encoding format.
- JavaBase 7731 2019-11-25 09:42:36
-
- Garbled characters appear when sending emails via java mail
- The solution to garbled characters when sending emails using the "mail" package in "java" is: first, specify the text encoding as "GB2312" when sending the body text, then specify the title encoding as "GB2312" when setting the email title, and finally send the body text. Just specify the transfer encoding as "base64" encoding.
- JavaBase 2960 2019-11-25 09:27:05
-
- How to enter an array from the keyboard in java
- The "java" method of inputting an array from the keyboard is: first create an object through the "Scanner" class, then call the "next()" method through this object to obtain the input data, and return the input data by calling the "toString()" method The object value represented, and finally the data is added to the array through a loop.
- JavaBase 14454 2019-11-23 16:00:50
-
- Java implements uploading pictures to the server
- The method of "java" to upload images to the server is: first set the buffer size and temporary file directory, and set the size limit of the uploaded file, then parse the request object to obtain the "List" object of the uploaded content, and determine whether it is an uploaded file. Then call the "write()" method to write the uploaded content to the file.
- JavaBase 2997 2019-11-23 15:40:23
-
- The file name is garbled when java downloads the file
- When "java" downloads files, the file name appears garbled. If it is a file name encoding problem, you can encode the file name to "UTF-8" or "ISO". If it is a browser incompatibility problem, you can use "URLEncode" to encode the file name. Encode "UTF-8" or convert bytes to "ISO".
- JavaBase 3687 2019-11-23 15:04:52
-
- How to verify whether the image verification code is correct in JAVA
- The method of verifying the image verification code in "java" is: first, you need to obtain the verification code object entered by the user, and then first determine whether the verification code is empty. If it is not empty, obtain the "toString()" method represented by the verification code. Number" object value, and finally compare the verification code object value with the specified object to determine whether it is correct.
- JavaBase 2881 2019-11-23 14:47:31
-
- Garbled characters appear when running java projects through bash/cmd
- The reason why garbled characters appear when running the "java" project through "bash" or "cmd" is: the default encoding of "cmd" and "bash" is "GBK". The solution is: first set the encoding method of "cmd" to "utf-8" through the "chcp 65001" command, and then specify the encoding parameters when running the project.
- JavaBase 3707 2019-11-23 13:56:30
-
- How to save files locally in java
- The method to save files locally in "java" is: first create a file object according to the file path to be saved, and then use the "exists" method to determine whether the file exists. If it does not exist, create a new file. If it exists, start passing the "FileOutPutStream" ” class creates a new file and writes data to the file.
- JavaBase 11845 2019-11-23 13:28:02
-
- What are the methods to enter a character in java
- The methods for inputting a character from the keyboard in "java" are: 1. Use the "read()" method to obtain, but this method can only obtain one character, and the type of the variable obtained must be of the "char" type; 2. , Use the "BufferedReader" class to obtain; 3. Use the "Scanner" class to obtain.
- JavaBase 6136 2019-11-23 11:48:52
-
- How to calculate the day of the year for a specified date in java
- How to calculate the day of the year for a specified date in Java: first calculate whether it is a leap year or an ordinary year through the year, February 28 days in ordinary years, February 29 days in leap years, the number of days in the remaining months is fixed, and then the number of days in the month before the specified month and The days in the specified months are added together, and the sum is the day of the year.
- JavaBase 4221 2019-12-05 11:57:06
-
- Strings in java are always garbled
- The reason why strings in "java" are always garbled is: "TOMCAT" uses "ISO8859-1" encoding by default. The solution is: first use "ISO8859-1" to convert the string obtained from "TOMCAT" into a byte array, and then use "GBK" to encode it.
- JavaBase 3452 2019-11-23 11:25:32
-
- How to determine whether a character is a number in java
- The method to determine whether a character is a number in "java" is: you can use the static method "isDigit()" in the "Character" class. The "isDigit()" method is used to determine whether the parameter character passed in is a number. If If the parameter character is a number, "true" is returned, otherwise "false" is returned.
- JavaBase 3132 2019-11-23 11:15:51