What would be the output for the following code? String word = - ProProfs Discuss
Advertisement

What would be the output for the following code?
String word = "abcde"; for (int i = 0; i <4; i+=2) System.out.print(word[i]);

Asked by Wyatt Williams, Last updated: Apr 17, 2024

+ Answer
Request
Question menu
Vote up Vote down

2 Answers

B. Mary

B. Mary

Health comes first, and I happen to know a lot about health.

B. Mary
B. Mary, Health Care manager, MHA(Master's In Healthcare Administration), Raleigh, North Carolina

Answered Dec 02, 2019

The correct answer to this question is Ac. Strings are a part of the programming language called Java. Java is an acronym, which stands for Java Standard Edition.

When it comes to strings, they are objects that represent a character value's sequence. The characters work identically to how the stings in Java do. There are two ways in which a string can be created.

The first way is through a string literal, which is done by using double-quotes. Another way is by using a new keyword and doing this way, a new object is created. The result is moved into a pool.

upvote downvote
Reply 

Wyatt Williams

Wyatt Williams

Wyatt Williams
Wyatt Williams

Answered Nov 08, 2017

Ac
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.