226k views
12 votes
8.3 code practice
Need help someone that is good a coding

8.3 code practice Need help someone that is good a coding-example-1
User Madepiet
by
4.7k points

1 Answer

5 votes

Answer:

Following are the code to the given question:

public class Main//defining class Main

{

public static void main(String[] abv)//defining main method

{

int nums[]={11,36,31,-2,11,-6};//defining an integer array nums

System.out.print("{");//print bracket

for(int i=0;i<nums.length;i++)//defining for loop to print value

{

System.out.print(nums[i]+",");//print array values

}

System.out.print("}");//print bracket

}

}

Output:

{11,36,31,-2,11,-6,}

Step-by-step explanation:

In this code, a class Arr is declared that uses the main method, and inside the main method, an integer array nums are declared, which initializes the integer values and uses the for loop to print the initialized values with the curly bracket to prints value between them.

User Bart Kerfeld
by
4.7k points