Please tell how to do this program.

Read about escape character in Java in additional material to the lecture.

Write a program that displays following two strings:
It's Windows path: "C:\Program Files\Java\jdk1.7.0\bin"
It's Java string: \"C:\\Program Files\\Java\\jdk1.7.0\\bin\"

asked 14 Mar '15, 04:48

Rajat's gravatar image

Rajat
316
accept rate: 0%


link

answered 14 Mar '15, 08:43

Elleonora%20Carry's gravatar image

Elleonora Carry ♦♦
275
accept rate: 16%

by doing this i got the correct answear . but it has not a pass testing . what should it be ?? String s = """+"C:" + "\"+"Program Files"+"\"+"Java"+"\"+"jdk1.7.0"+"\"+"bin"+"""; String s2= "\"+"""+"C:"+"\"+"\"+"Program Files"+"\"+"\"+"Java"+"\"+"\"+"jdk1.7.0"+"\"+"\"+"bin"+"\"+"""; System.out.println(s); System.out.println(s2);

link

answered 15 Mar '15, 07:38

Muhammad%20Hassan%20Durrani's gravatar image

Muhammad Has...
4311524
accept rate: 0%

Also help me out please in this

link

answered 30 Apr '15, 05:53

shariq15's gravatar image

shariq15
1215
accept rate: 0%

first you have to try it yourself . i can give you a complete code but it will not help you in learning . show me something code . then i will guide you out . it can easily be done by reading about escape characters :)

link

answered 30 Apr '15, 10:36

Muhammad%20Hassan%20Durrani's gravatar image

Muhammad Has...
4311524
accept rate: 0%

I have tried to learn it ...but could not find any site to get a proper learning ...guide me a site or a link so that i can learn and do my task TO : Muhammad hassan

link

answered 30 Apr '15, 16:19

shariq15's gravatar image

shariq15
1215
accept rate: 0%

http://docs.oracle.com/javase/tutorial/java/data/characters.html

try to read it carefully . answear is in this article .

link

answered 30 Apr '15, 18:13

Muhammad%20Hassan%20Durrani's gravatar image

Muhammad Has...
4311524
accept rate: 0%

Here's a Working Code. public class Solution { public static void main(String[] args) { //add your code here String one = ""C:\Program Files\Java\jdk1.7.0\bin""; System.out.println("It's Windows path: "+one+""); String two = "\"C:\\Program Files\\Java\\jdk1.7.0\\bin\""; System.out.println("It's Java string: "+two+"");

}

}

link

answered 26 May '15, 12:32

Asif%20Ali's gravatar image

Asif Ali
111
accept rate: 0%

Try This: String s1="It's Windows path:"; String s2=""C:\Program Files\Java\jdk1.7.0\bin""; String s3="It's Java string:"; String s4="\"C:\\Program Files\\Java\\jdk1.7.0\\bin\""; System.out.println(s1+" "+s2); System.out.println(s3+" "+s4);

link

answered 08 Jun '15, 06:28

bhawna28's gravatar image

bhawna28
111
accept rate: 0%

Make sure to use an escape character for EVERY special character in the string

link

answered 13 Aug '15, 07:20

Anastasia%20Shatova's gravatar image

Anastasia Sh...
1
accept rate: 0%

    String a = "\"C:\\Program Files\\Java\\jdk1.7.0\\bin\""; 
    System.out.println("It's Windows path: "+a+""); 
    String b = "\\\"C:\\\\Program Files\\\\Java\\\\jdk1.7.0\\\\bin\\\""; 
    System.out.println("It's Java string: "+b+"");
link

answered 09 Apr, 19:25

dweller's gravatar image

dweller
111
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×69
×42
×11

Asked: 14 Mar '15, 04:48

Seen: 3,967 times

Last updated: 09 Apr, 19:25