---
title: "What’s the purpose of Static methods and static variables in Java?"  
description: "What’s the purpose of Static methods and static variables in Java?"  
author: "Navya Khurana"  
published: 2017-12-19  
canonical: https://answers.mindstick.com/qa/31847/what-s-the-purpose-of-static-methods-and-static-variables-in-java  
category: "technology"  
tags: ["java programming"]  
reading_time: 1 minute  

---

# What’s the purpose of Static methods and static variables in Java?

What’s the [purpose](https://answers.mindstick.com/qa/51345/what-was-the-purpose-of-grandfather-clauses) of [Static](https://www.mindstick.com/articles/12098/the-static-keyword-the-static-methods) [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) and static [variables](https://www.mindstick.com/articles/715/php-variables) in [Java](https://www.mindstick.com/articles/1702/introduction-to-java)?

## Answers

### Answer by Pawan Shukla

The **method and variables** marked as **static** when it belongs to a class rather than to any particular instance of the class. During development of the project when there is a **need to share a method or a variable between multiple objects of a class instead of creating separate copies for each object**, we use static keyword to make a method or variable shared for all objects. In Java, **only the class is adequate to invoke a static method or access a static variable**.Where a static variable is shared by all the instances of that class, means only one copy of the static variable is maintained.


---

Original Source: https://answers.mindstick.com/qa/31847/what-s-the-purpose-of-static-methods-and-static-variables-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
