🚀 Welcome to www.UptuExam.com — Free Notes, Previous Papers, AI Search, Tutorials, Results, Syllabus, Important Questions and More...
AI is preparing your answer...
Searching notes, previous year papers, tutorials, AI content and important exam resources for you...

STATIC KEYWORD


STATIC KEYWORD

In a class we can have 2 types of members.

i.  Instance members – represents attributes and behavior of individual objects.
ii.    Class members – represents attributes and behavior of the whole class.






To understand where we need to use static, see the diagram below-







v  By default all the members of a class are instance members. In order to associate a member of a class static keyword is used.

v  static denotes execution of whole class.


Syntax of compiling –

javac NameOfSourceFile





example - 














No comments:

Post a Comment