0% found this document useful (0 votes)
156 views10 pages

Java For Beginners: Chris Coetzee

This document provides an overview of different levels of Java coding and concepts related to arrays and linked lists in Java. It discusses the key differences between arrays and linked lists, how to create and add/remove items from linked lists, useful linked list methods, and cautions the reader to import necessary utility libraries and use the correct size/length methods for different data structures. The example code is missing importing the LinkedList class from the Java utility library.

Uploaded by

Chakri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views10 pages

Java For Beginners: Chris Coetzee

This document provides an overview of different levels of Java coding and concepts related to arrays and linked lists in Java. It discusses the key differences between arrays and linked lists, how to create and add/remove items from linked lists, useful linked list methods, and cautions the reader to import necessary utility libraries and use the correct size/length methods for different data structures. The example code is missing importing the LinkedList class from the Java utility library.

Uploaded by

Chakri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Java for

Beginners University

Greenwich

Computing At

School

DASCO

Chris
Coetzee
Levels of Java coding
1: Syntax, laws, variables, output
2: Input, calculations, String manipulation
3: Selection (IF-ELSE)
4: Iteration/Loops (FOR/WHILE)
5: Complex algorithms
6: Arrays/Linked Lists
7: File management
8: Methods
9: Objects and classes
10: Graphical user interface elements
Arrays vs Linked Lists

Array List

Fixed size Size can change

One or Two
Only linear
dimensions
Before you using a
Linked List

Remember to import the utility libraries!

import java.util.*;
Creating a Linked List

Warning: dont use double, Remember the ()

int, char or boolean at the end!


Adding items to a linked list

Output
Removing items from a
linked list

Output
Useful LinkedList methods
Method What does it do

.add(xx) Adds xx onto the end of the


linked list

.remove(y) Removes the element at


position y

.size() Returns how many elements


there are in the linked list

Returns what element xx is


.indexOf(xx) stored in; returns -1 if element
was not found
Beware getting the size!
.size() Linked Lists
e.g. int k = zones.size(); //zones is a linked list

.length() Strings
e.g. int m = name.length(); //name is a String

.length arrays
e.g. int g = boxes.length; //boxes is an array
LinkedList example

What did the programmer

forget to do?

You might also like