Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Access Modifiers - Introduduction to Jave Programming - Lecture Slides, Slides of Java Programming

In the course of the Introduction to Jave Programming, we study the basic syntax and the basic program in java. In these lecture slides the key points are:Access Modifiers, Highlights, Public Vs Private, Access Modifiers, Overloading Methods, Constructors, Variable, Easier to Modify, Update Code, Argument

Typology: Slides

2012/2013

Uploaded on 04/23/2013

sarmistha
sarmistha 🇮🇳

3.8

(22)

113 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Access modifiers and
more on methods
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Access Modifiers - Introduduction to Jave Programming - Lecture Slides and more Slides Java Programming in PDF only on Docsity!

Access modifiers and

more on methods

Announcements

HW 2 due today (now) HW 3 posted

public vs private

public vs private

The public modifier allows any class anywhere to access the variable/method The private modifier only allows access in the class where the variable/method is defined (See: RunSuperDouble.java)

public vs private

public vs private

Overloading

When overloading, Java will still convert types automatically (int to double) But this will only happen if there is not already a match for the current type If the computer cannot decide on the best conversion, the code will not run (See: BadOverload.java)

Constructors

Whenever you make a Class type (with new) you have used a constructor method For example: Scanner input = new Scanner(System.in); Constructors always have the same method name as the class and are only run (once) when you make a variable of that Class type (See: Constructor.java) Docsity.com