Purchase Solution

JAVA code snippets

Not what you're looking for?

Ask Custom Question

Write a method definition to count and then return the number of elements in a passed integer array, that have a value greater than 0.

Write a nested loop structure that prints out the following number series: 111 112 121 122 211 212 221 222. The innermost loop may have only one print statement and no literal string output except a space (" ").

Write a class declaration for a student that has String first, last, and middle names as data fields. Declare only the data members and a no-arg constructor.

Write a method definition that prints out the value of 2 to the powers of 1 - 31 in a 10 character width, right-justified column. You may not use any literals or Math methods.

Write a program (with main) that will ask the user for 10 data elements which will be assigned sequentially to an array, print the array and then copy that data into a second array in reverse order and print it.

Purchase this Solution

Solution Summary

This solution provides an explanation how to perform the given functions in Java. Including a writing a nested loop structure, several method definitions, and a program.

Purchase this Solution


Free BrainMass Quizzes
C# variables and classes

This quiz contains questions about C# classes and variables.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.