Question 7
Back to Exercise
How do you split "192.168.1.1" into its four numbers?
- A s.split(".")
- B s.split("\\.") Correct
- C s.split('.')
- D s.split(" . ")
Correct Answer: Option B
split takes a regex, in which . matches any character; "\\." in Java source is the regex \. (a literal dot).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!