---
title: "Can we make a class static ?"  
description: "Can we make a class static ?"  
author: "Anonymous User"  
published: 2015-07-06  
updated: 2020-09-18  
canonical: https://www.mindstick.com/interview/2685/can-we-make-a-class-static  
category: "java"  
tags: ["java", "class"]  
reading_time: 1 minute  

---

# Can we make a class static ?

A class can be made static provided that the class is a nested class. A nested class is class which is defined inside a class. But top class can't me made static. Example

```
public class Test{  static class StaticInnerClass { public static void innerMethod() { System.out.println("Static Inner Class!"); } }  public static void main(String args[]) { Test.StaticInnerClass.innerMethod(); }}
```

\

## Answers

### Answer by Anonymous User

A class can be made static provided that the class is a nested class. A nested class is class which is defined inside a class. But top class can't me made static. Example

```
public class Test{  static class StaticInnerClass { public static void innerMethod() { System.out.println("Static Inner Class!"); } }  public static void main(String args[]) { Test.StaticInnerClass.innerMethod(); }}
```

\


---

Original Source: https://www.mindstick.com/interview/2685/can-we-make-a-class-static

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
