Java | JSP | JSF Answers

Questions: 4 418

Answers by our Experts: 3 943

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

5-8. How do you access the element of array a located at row 2 and column 4?
a{2}{4}
a( 2, 4 )
a[2][4]
a[4][2]
41-8. Where is the error (although this code will compile and run) in this code sequence?
int a[ ] = { 3, 26, 48, 5 };
int b[ ] = { 3, 26, 48, 5 };
if ( a != b )
System.out.println( "Array elements are NOT identical" );
43-8. Where is the logic error in this code sequence?
int [ ] a = { 3, 26, 48, 5 };
System.out.println( "The array elements are " + a );
46-8. You coded the following on lines 26, 27, and 28 of the class Test.java:
int[]a={2,7,8,9,11,16}; //line26ofclassTest.java
for ( int i = 0; i <= a.length; i++ ) // line 27 of class Test.java
System.out.println( a[i] ); // line 28 of class Test.java

The code compiles properly, but when you run, you get the following message:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at Test.main ( Test.java:28 )

Explain what the problem is and how to fix it.
55-8. Write a method that returns the sum of all the elements of an array of ints that have an odd index.
57-8. Write a method that returns true if an array of Strings contains the String "Hellofalse otherwise.
58.-8 Write a method that prints all the elements of an array of chars in reverse order .
73-8. What do you think are advantages and disadvantages of arrays?
I have this coursework due in 5 hours and am having trouble implementing binary semaphores. My task is basically from the given semaphore class derive a binary semaphore class and make use of 3 threads, threadX, threadY, and threadZ to repeatedly form the pattern Z,X,Y. (threadX prints X, Y prints Y and Z prints Z). The binary semaphores are like a lock for these threads so as to ensure that they always print out the pattern in the same order repeatedly until system.exit(0); is called. How would i go about this?
write a program that reads in a file containing an essay and stop immediatly with an error message(it will throw a runtimeexception when it first sees a texting word), the first time it finds a texting word such as "lol, roflo,l brb, omg, txt, 2nite, nite, bff, u and r". only if the essay doesnt contain a texting word will the program stop with no error message.
LATEST TUTORIALS
APPROVED BY CLIENTS