+ 2

In Java if I have to print a statement with double slash (//) OR use it anywhere in the code how will I do it ?

If I have to use the double slash (//) NOT for a comment ,like example I have to print a statement having two slash (//) it becomes a comment which I don't want. How will I get the two // without it becoming a comment?

29th Jan 2017, 4:31 PM
Piyush Pandey
Piyush Pandey - avatar
7 Respostas
+ 11
System.out.println("/"+"/");
29th Jan 2017, 4:32 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 1
oh thanks @Blightedsage
29th Jan 2017, 5:22 PM
Piyush Pandey
Piyush Pandey - avatar
0
it won't work.-_- what if I have to use it in the code not a print statement!?
29th Jan 2017, 4:37 PM
Piyush Pandey
Piyush Pandey - avatar
0
still won't work
29th Jan 2017, 4:38 PM
Piyush Pandey
Piyush Pandey - avatar
0
@ValentinHacker it won't work type it in a program it comes as an error.
29th Jan 2017, 4:41 PM
Piyush Pandey
Piyush Pandey - avatar
- 1
system.out.println (@"//stuff"); should work I havent used Java for a while.
29th Jan 2017, 5:08 PM
Alex
Alex - avatar
- 2
Looks like this is a bug in Sololearn's online java compiler. Placing // in a string in my compiler over here yields no error.
29th Jan 2017, 5:20 PM
Blightedsage
Blightedsage - avatar