Click here to Skip to main content
15,908,115 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

the following lines shows error

System.out.println("D:\\\"+name+".jpg");

it shows error in three slashes

but when i run it with two slashes it removes one on its own so i tried with three and now its showing error


please help

thanks in advance
Posted
Comments
[no name] 1-Apr-13 7:58am    
So remove the slash and remove the error. Two slashes is normal. It removes one slash because slash is the escape character. What you are seeing is what is supposed to happen.

Here is all your answer :----------



Escape character
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 1-Apr-13 10:50am    
Sure, a 5.
—SA
Number of slashes you want to display in OUTPUT just double it in CODE
e.g. for 2 slashes
System.out.println("D:\\\\"+name+".jpg");

and for 3 add 6
 
Share this answer
 
Two slashes is normal. The compiler only takes one of them, because, as said above, one is the escape character. Take for example:
Java
Image myImage=new Image("D:\\image.jpg");


The program knows that it must access the file D:\image.jpg. Delete one slash and you should be ok.
Best of luck.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900