JavaDeploy
SiteMap
Readers Writers
Java Streams
Java Programming
Java Language
Java Fundamentals
«Prev
Next»
Java Programming
Java Technology
Useful Technology
Acquiring Java SDK
Java Compiler
Tic Tac Toe Applet
Java Applet Viewer
Java TM Interpreter
Java SDK Conclusion
OO Programming
OO Fundamentals
Understanding Classes
Object Communication
Defining Objects
Adding Behavior Methods
OO Programming Conclusion
OO Programming - Quiz
122
Java Programs
Java Api
Applications Applets
Java main() method
Static Class Member
Command Line Arguments
Building String Characters
Standard IO Communication
Application Construction
122
Program Flow
Conditional Branching
Conditional Ternary Operator
Switch Statement
For Loops
foreach Loop
Nested Loops
while Loops
doWhile Loop
Break Statement
Control Flow Conclusion
Programming Fundamentals
Identifiers, Keywords, Literals
Java Comments
Java Data Types
Storing Data Arrays
Manipulating Text
Evaluating Expressions
Numeric Operators
Boolean Assignment Operators
Compound Operators
Java Language Conclusion
Object Classes
Inheritance Fundamentals
Creating and Accessing an Array - Exercise
Creating and accessing an Array
Objective:
Create and access an array.
Exercise Grading
This exercise is worth a total of 1 point.
Exercise instructions
Create a simple command-line application named FirstLast that creates and initializes an array of chars.
In the main() method of this application create an array of char called letters and initialize it with the letters in the word "object".
You will not need to use the String class in this exercise. Use
System.out.println()
to display the first and last elements in the array. Try not to use a constant for the index of the last element. Here is one possible way the output for this application could appear:
The first letter is 'o' and the last letter is 't'. After completing the exercise, click the
Submit
button and view the results page.