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]);

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

Change Image    Delete

Asked by Wyatt Williams, Last updated: Nov 09, 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