New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Packages Notes

by: Camila Correia

Packages Notes CSCI 3310

Camila Correia

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

These notes cover Packages in Java
Advanced Data Structures and Data Abstraction
Dr. Ding
Class Notes
25 ?




Popular in Advanced Data Structures and Data Abstraction

Popular in ComputerScienence

This 4 page Class Notes was uploaded by Camila Correia on Tuesday March 29, 2016. The Class Notes belongs to CSCI 3310 at East Carolina University taught by Dr. Ding in Winter 2016. Since its upload, it has received 10 views. For similar materials see Advanced Data Structures and Data Abstraction in ComputerScienence at East Carolina University.

Similar to CSCI 3310 at ECU

Popular in ComputerScienence


Reviews for Packages Notes


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 03/29/16
Packages Tuesday, January 19, 2016 2:03 PM Package - to group classes together Syntax: Package <package_name>; **all the files in the same package will be put in the same directory, using the package name** Ex: Java.util Java.lang -these are all packages Import java.util.*; < ----import all the classes and files in this package Format: Import <package_name>.<class_name>; Class -components (data (variables, fields),methods) ** each class is going to be a separate file** public class Myclass { <variable declarations> <constants> <methods> } Access modifier for variables and methods: -public (everyone has access) -private -protected -no access modifier (package private) Ex: public static Circle { -protected -no access modifier (package private) Ex: public static Circle { private double radius; public static final double PI = 3.14159; public double getRadius() < ----- get method (getter, access method) { return radius; } public void setRadius(double r) < ------ set method (setter, mutator method) { radius = r; } // Area = pi(r^2) public double compArea() { return PI * radius * radius; } } < IN ANOTHER CLASS>: Circle c1 = new Circle(); C1.setRadius(5.0); Double area = c1.compArea(); Circle c2 = new Circle(2.5); Constructors: -special methods used to initialize an object Ex: public Circle () <------- default constructor { radius = 0; } ------both of these are constructors Public Circle (double r) { radius = r; radius = 0; } ------both of these are constructors Public Circle (double r) { radius = r; } -Method Overloading--> you can have multiple methods with the same name, but they have different numbers or type of parameters. Ex: A. Method called int add(int a, int b) B. Method called int add(int I, int j, int k) C. Method called double add(double x, double y) Add(2,3) --> A Add(4,7,13) --> B Add(2.5, 90.7) --> C Add(3, 6.5) --> C Important Notes about Constructors: *don't confuse the heading for the class and the heading for the constructors, they are NOT the same thing *the name of a constructor is the same as the name of the class *a constructor does not have ANY return type, not even void *the compiler will generate a default constructor, with no parameters, if and only if no constructor is defined in a class *a class can have multiple constructors (a form of method overloading) The "this" Keyword Two meanings: 1. The "this" object -Ex: int k; this.k; -Ex: public void setRadius(double radius) { this.radius = radius; <-- sets the parameter radius to radius in the Circle class } 2. The "this" method -to call a constructor from another constructor this.radius = radius; <-- sets the parameter radius to radius in the Circle class } 2. The "this" method -to call a constructor from another constructor Ex: public Circle() { radius = 0; } public Circle (double r) { radius = r; } public Circle() { this(0); }


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.