What will be the output of the code snippet below? - ProProfs Discuss
Advertisement

What will be the output of the code snippet below?

What will be the output of the code snippet below?

Change Image    Delete

class TestString2 {public static void main(String args[]) {String s1 = "Test1";String s2 = "Test2";s1.concat(s2);System.out.println(""+s1.charAt(s1.length() - 3) + s1.indexOf(s2));}}

Asked by Leonfernando, Last updated: Mar 31, 2024

+ Answer
Request
Question menu
Vote up Vote down

2 Answers

l.Steven

l.Steven

l.Steven
L.Steven

Answered Jan 07, 2018

The output of the above code would be S-1. Java is a very popular computer programming language. It is usually designed to have as less implementations as possible. Usually, java applications are formed together to bytecode that can run on other java virtual machine irrespective of the computer architecture.

Originally, the development of java was done by James gosling. The latest version of java is java 9 which was released on the 21st of September 2017. It is one of the two versions that are currently provided free support by oracle. The earlier versions are provided support by other commercial companies.

upvote downvote
Reply 

John Smith

John Smith

John Smith
John Smith

Answered Mar 13, 2017

S-1
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.