Answer:
Result is: 65
Explanation:
To analyze this code let us asign line numbers:
- public class Test {
- public static void main( String[] args )
- { int[] a; a = new int[ 10 ];
- for ( int i = 0; i < a.length; i++ )
- a[ i ] = i + 2;
- int result = 0;
- for ( int i = 0; i < a.length; i++ )
- result += a[ i ];
- System.out.printf( "Result is: %d\n", result );
- }
- }
On line 3, an array of ints is created of size 10
On line 4 and 5 a for loop is used to add values to the array. at the end of the execution of line 4 and 5, the array will contain the following elements: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
On line 6 an int variable result is created and initialized to 0
line 7 and 8 allows a for loop through the array adding up all the elements of the array and assigning them to result
Line 9 outputs the value of result (Which is the total sum)
Answer:
The array index by using split function.
45 20 50 30 80 10 60 70 40 90
45 20 40 30 80 10 60 70 50 90
45 20 40 30 10 80 60 70 50 90
10 20 40 30 45 80 60 70 50 90
Explanation:
In the following statement, there is an integer array type variable x and its index value is 10 that means it contains only 10 numeric values and then, they set split function which split the array and the split function is the built-in function which is used to separate the string or an array. So, the array is split into the following parts.
Answer:
Locate the author and request permission to use the material.
Explanation:
There are different types of copyright though, they may just point you at what type of copyright it has and you need to read it to figure out what you can/can't do with the material.
Answer: A) It is directly accessible only in B1
Explanation: In the given chunk of code, Class B1 is a base class. Class B2 is derived class of class B1. Class B3 is derived class of B2. As you can see class B1 has two members or instance variables i and j. Instance variable cannot be directly accessible by both B2 and B3. If you see this statement of the given code private int j; the keyword private is used with the variable j. This keyword is called access specifier. Access specifiers specifies how the members of a class can be accessed. These members are attributes and methods of that class. Any member of a class that are declared private cannot be inherited by derived classes of that class. Additionally these private members cannot be accessed from within any method inside derived class. So j is directly accessible only in B1. You can access a private instance variable from within the same class or can access it through the methods of class.
A, most don't have a pre-plan process