//Improve the understandability of the below given code:
import java.util.*; /* it is importing all class in java.util package */
class problem3 /* creating a class problem3 */
{ /* opening braces for class problem3 */
int[] numArray = new int[10]; /* declaring an array of integer named numArray & is assigned with 10 element */
public static void incrementElements (int[] integerArray) /* a method named incrementElements whose return type
void it means it is not returning any value.
Static means it can be automaticaly called.
public means it can be called anywhere in the program.
passing parameter array of integer */
{ /* opening braces for method incrementElements */
int arraylen = integerArray.length; /* arraylen is any variable of data type integer which
calculated lenght of array by using integerArray.length */
for (int i = 0; i < arraylen; i ++) /* a loop stating from i=0 to lenght of array and increment every time
by +1 */
{
System.out.println(integerArray[i]); /* printing present integer value of array */
}
for (int i = 0; i < arraylen; i ++) /* same foor loop is called */
{
integerArray[i] = integerArray[i] + 10; /* printing value by increamenting 10 in each present value of array */
}
for (int i=0; i < arraylen; i ++) /* same foor loop is called */
{
System.out.println(integerArray[i]); /* last printed value will be reprint */
}
}
Search This Blog
Popular Posts
-
1.What is the correct syntax of the declaration which defines the XML version? Option: a. b. c. d. None of the above e. Ans: a 2.What is ...
-
1. Which of following represent logical storage of data? Option : a. Table b. View c. None. d. Index Ans: b 2. Which SQL statement is used t...
-
1. Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes...
-
1.Which of the following is closer to machine Code ? Choose one answer. a. Machine language b. High level language c. None of the above d. A...
-
1.Which of the following Construct in formal model in software engineering execute each statement in succession. Choose one answer. a. Itera...
-
class Problem1 /* creating a class problem1 */ { /* opening braces for class problem1 */ int[] a...
-
1.Which Geography gives the maximum revenue for TCS? Choose one answer. a. Africa b. India c. Asia Pacific d. North America Ans : d 2.Which ...
-
Question 1: Provide the create table syntax to Create a Table Employee whose details are as below. Employee(EmployeeID, LastName, FirstName,...
-
//Improve the understandability of the below given code: import java.util.*; /* it is importing all class in java.util pac...
-
Aspire – Java Assignment-1 - Solutions 1. Write a program to find the difference between sum of the squares and the square of the sums of n ...
hey,,i want answers of basics of programming from test and quiz
ReplyDelete