Consider the following code snippet. Assume all imports are done and preview feature is enabled. Predict the output

 int x = 50;
 int y = 30;
 StringTemplate st = StringTemplate.RAW."\{x} + \{y} = \{x - y}";
 System.out.println(st.fragments()); //Line1
 System.out.println(st.values());

Compilation error at Line1- undefined fragments() method.

[, + , = , ]
[50, 30, 20]

[, + , = , ]
[x, y, x-y]

[, + , = , -, ]
[50, 30, 20]

Verified Answer
Correct Option - b

To get all Infosys Certified Java SE 21 Developer Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee

Telegram