lesson_04.2

lesson_04.2 - Data Types Reference Types Objective To...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Data Types – Reference Types Objective To understand what reference types are The need to study reference types To understand Java standard packages To differentiate between Java defined types and user defined types To have a deeper understanding of the String class To get acquainted with the Math class To get acquainted with the Wrapper classes
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Data Types – Reference Types Reference types - any data type that is composed of primitive data types as its based type. In other words, it is an aggregate of primitive types. Reference types in Java are: The array data structure, and The class data type. In this section we will briefly discuss the concept of array. We will discuss the class type to the extent of the fundamental classes of Java.
Background image of page 2
Reference Types - Array Array An array is a set of storage locations set aside to hold one type of data. It is simply a means where by we can store values of the same type by using one generic name. The list of items are stored linearly Hence the items can be accessed by their relative position in the list. Arrays are real objects in Java. Storage space is allocated for an array during execution time. The concept will be discussed fully in future lesson
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reference Types - Array 10 20 30 40 50 60 70 80 arr indeces 0 1 2 3 4 5 6 7 Data This is the most we will say about arrays for now
Background image of page 4
Reference Types - Class The concept of class as you know is the fundamental construct upon which Java is built. A class serves as a blueprint or a template for a certain type of object. All data types other than the primitive type or the array must be addressed in terms of class. This is evident in the way that we have been using class. For instance, going back to the class Book. In order to use this class we had to declare variables of the type: That is, Book b1; for instance
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Reference Types - Standard Packages Java has a vast and rich collection of classes. These classes are stored in respective directories and subdirectories. Each directory or subdirectory is called, a package. Programmers can use these classes in their specific applications. There are several packages in Java. Two of the most important packages in the language are java and javax .
Background image of page 6
Java Standard Packages java and javax packages, along with their sub-packages. Some of the sub- packages also contain sub-packages of their own The sub-package lang is a special package is for general programming The sub-package javax is designed for Graphical User Interface programming (GUI)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Standard Package- lang The java.lang package contains classes that are fundamental to Java. All of the classes in this package are available in your program automatically.
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 36

lesson_04.2 - Data Types Reference Types Objective To...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online