---
title: "What is best way to declaration a variable ? follow below example?"  
description: "What is best way to declaration a variable ? follow below example?"  
author: "marcel ethan"  
published: 2013-05-15  
updated: 2013-05-15  
canonical: https://www.mindstick.com/forum/888/what-is-best-way-to-declaration-a-variable-follow-below-example  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# What is best way to declaration a variable ? follow below example?

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)! \
Example:\
[String](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) one="One", two="Two", Three="Three";(or)\
String one="One";String two="Two";String Three="Three";\
See, above [e.g](https://www.mindstick.com/forum/157370/how-to-swap-neighbor-characters-in-string-e-g-string-demo-would-be-edom) which one is best way in real time? what is [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) both us? i am using 1st one it is save the [class file](https://www.mindstick.com/forum/60/how-we-add-dll-with-other-class-file) memory. but all programmer use 2nd one.why there was use 2nd I did not understand?\
Please give proper solution!Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Marcel!\
There is no difference. Compiler will do it in the best way, so in byte code you would have always (in both cases):\
// access flags 0x0 Ljava/lang/String; one\
// access flags 0x0 Ljava/lang/String; two\
// access flags 0x0 Ljava/lang/String; Three\
Going this way, use what is more appropriate in your project. Don't care about the memory!\


---

Original Source: https://www.mindstick.com/forum/888/what-is-best-way-to-declaration-a-variable-follow-below-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
