• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

doubt in class types

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Class A{

Class B{}

Static Class c{}

}

A is Outer Class
B is regular inner Class
C is Nested toplevel or Static Inner Class I am clear about it now consider this class

Class D{

static int i;
static void display(){}

} in other words class D is having only static members and there are no any instance members in such cases can we call class D as a Static Class.

Thanks
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vishwa raj asked

class D is having only static members and there are no any instance members in such cases can we call class D as a Static Class.


No. "static class" is more a nick name for a top level nested class. There are no real "static classes".
It's better to avoid the term "static class" at all as it may cause only confusion.


Classes like class D that have only static members are often called "utility classes". And they are designed in a way that you cannot instanciate them. java.lang.Math is an example of these.

Bu.
 
The only thing that kept the leeches off of me was this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic