What is the difference between declaring a variable and defining a variable? Ans. In declaration we just mention the type of the variable and it's name. We do not initialize it. But defining means declaration initialization. Example: String s; is just a declaration while String s = new String ('abcd'); Or String s = 'abcd'; are both definitions. - Study24x7
Social learning Network
20 Nov 2023 12:50 PM study24x7 study24x7

What is the difference between declaring a variable and defining a variable? Ans. In declaration we just mention the type of the variable and it's name. We do not initialize it. But defining means declaration + initialization. Example: String s; is just a declaration while Stri...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles