Print all even numbers in an array exactly like this -> {2,4,6}. Without even concatenating the curly braces.

AnswerBot
6mo

Print even numbers in array without curly braces.

  • Iterate through array and check if each element is even.

  • If element is even, add it to a new array of strings.

  • Join the elements of new array with commas...read more

Anonymous
5mo
public class Test1 { public static void main(String[] args) { int[] arr = {1,3,5,6,8}; System.out.print("{"); boolean comm = true; for (int i = 0 ; i< arr.length ; i++){ if (arr[i]%2 == 0 ){ if (comm)...read more
Help your peers!
Add answer anonymously...
LTIMindtree Automation Test Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter