Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Java API Course Lecture Slides 7 June 2010 “ And you guys were putting.

Similar presentations


Presentation on theme: "CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Java API Course Lecture Slides 7 June 2010 “ And you guys were putting."— Presentation transcript:

1 CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Java API Course Lecture Slides 7 June 2010 “ And you guys were putting Java in light bulbs and everything else. ” --Steve Jobs

2 Java Library Oracle (earlier Sun) ships hundreds of pre- built classes This set of classes is called the Java library or the Java API 2

3 Packages Classes are grouped into packages Packages are hierarchical you can have packages within packages. Example java.lang.Math indicates that Math is a class in the package lang and that lang is a package in the package java. 3

4 Some Java Packages 4 java.langincludes most fundamental classes like System, String, Math, etc. java.utilgeneral utility classes like Arrays, Date, Calendar, etc. java.ioFile I/O classes java.awtGUI development javax.swing GUI development java.netlow-level internet I/O

5 Using a class from Java API Find out which package the class is in Put an import statement at the top of your source code file Example: import java.util.Arrays; import java.util.*; Now you can use the class and its methods If you do not have the import statement, you can still use the class, but every time you will have to qualify the class name with the package information. For example, java.util.Arrays.sort(…) 5

6 Knowing about Java API How do you know what classes are there in Java API or methods are there in a class in Java API Go to : Click on the package name and then the class name to know about what that class can do for you 6 http://java.sun.com/javase/6/docs/api/index.html


Download ppt "CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Java API Course Lecture Slides 7 June 2010 “ And you guys were putting."

Similar presentations


Ads by Google