以下行显示错误:: System.out.println(" D:\\\" + name +" .jpg");你呢? [英] the following line shows error ::System.out.println("D:\\\"+name+".jpg"); .... y ?

查看:83
本文介绍了以下行显示错误:: System.out.println(" D:\\\" + name +" .jpg");你呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi




以下行显示错误



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



它显示三个斜线错误



但是当我用两个斜线运行时它会自动删除一个,所以我尝试了三个,现在它显示错误





请帮助



提前感谢

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

推荐答案

以下是您的全部答案: - ---------







Escape character
Here is all your answer :----------



Escape character


要在OUTPUT中显示的斜杠数量只需在CODE中加倍

例如for 2 slash
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");



和3加6


and for 3 add 6


两个斜线是正常的。编译器只接受其中一个,因为,如上所述,一个是转义字符。举例来说:

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





程序知道它必须访问文件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.


这篇关于以下行显示错误:: System.out.println(" D:\\\" + name +" .jpg");你呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆