"Local Resource Path && network resource path && use of forward and backward slashes in Java"

Source: Internet
Author: User

I. Concepts and usage

Left Right counter

Let's take a look at the concept of escape characters: through \,? To change the meaning of the letter or symbol behind it. It means to change the meaning of the letter itself.

Take the "\" symbol for example, there are many operations in Java, such as file operations, need to use the path of this thing, than

such as: Com\mypackage\xxx.xml, this path is generally expressed in string form,

But the question is, Java does not know whether your number is the next level in the path, or the meaning of the string "\".

Forward slash/denote division, delimited. Typically used in Windows systems to separate command-line arguments,/indicate options, and so on. cannot be a file name.

Backslash \, used in Windows system to represent the directory.

  In the UNIX system, the/represents the directory. Because the web follows UNIX naming, in the URL (URL),/represents the directory.

  \ is an escape character in C #

The following is a chart of the Java Transit characters

Second, the problems encountered in the actual development

Specify when to upload the picture why is the \ \ Escape to \ Local path with ' \ ' expression?

Windows uses backslashes ("\") to indicate that a path's history comes from DOS, while another tradition of DOS is to use a slash ("/") to denote command-line arguments, such as: CD%systemdrive%dir/s/b shell32.dll since the DOS side slash is occupied, Had to find the closest one. That's it. In UNIX environments, we use a minus sign ("-") and a double minus sign ("--") to represent command-line arguments. Using a slash to indicate a command-line argument is a compatibility reason. The problem originally originated with IBM. IBM contributed a large number of tools when it first joined DOS development by using slashes to handle command-line arguments. This tradition stems from dec/ibm, such as the VMS that used to handle command-line arguments with slashes, whose directory delimiter is the dollar symbol ("$"). By the way, this tradition has also been partially inherited into DOS and windows, and the Japanese version of Windows displays the backslash as "¥" on the screen, although it is actually a backslash. Today's Windows kernel can actually support both slash and backslash when working with paths. Many times we see errors when using slashes because of application-level reasons. For example, Cmd.exe does not support using a slash to represent the path, and PowerShell.exe supports it, and for this reason PowerShell begins to use the minus sign as the starting character for the command line arguments.

Local resource Path && network resource path && use of backslashes in Java

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.