{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

week-10 - COMP 202 Week 10 COMP 202 Introduction to...

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

View Full Document Right Arrow Icon
COMP 202 – Introduction to Computing 1 COMP 202 – Week 10 Static Artifacts and the Command-Line CONTENTS : • Static variables and methods • Command-line arguments Thinking Like A Programmer : Selecting when to use features in your program
Image of page 1

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

View Full Document Right Arrow Icon
COMP 202 – Introduction to Computing 1 the static modifier
Image of page 2
COMP 202 – Introduction to Computing 1 COMP 202 - Week 10 3 static Members of a Class The static modifier can be applied to any class member – variables as well as methods It associates a member variable or method with the class rather than an object of that class The memory space for a static variable is created as soon as the class is defined, rather than when an object of that class is instantiated. Static members of a class are usable even if no object is instantiated for that class. In that case they are accessed through the class name instead of object reference.
Image of page 3

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

View Full Document Right Arrow Icon