menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Day 4: Met...
source image

Dev

2w

read

257

img
dot

Image Credit: Dev

Day 4: Methods,static & Non static.

  • In Java, we call or access an object by creating an object of a class using the new keyword and calling methods and variables using the object.
  • Methods in Java provide code reusability, improve readability, reduce redundancy, and make debugging easier.
  • Static methods in Java are declared using the static keyword, belong to the class rather than a specific instance, can be accessed without creating an object, and can't access non-static members directly.
  • Global variables in Java can be instance variables or static variables, can be accessed by all methods in the class, and are declared outside of methods, inside the class; local variables are declared inside a method, constructor, or block, and can only be accessed within the method where they are declared.

Read Full Article

like

15 Likes

For uninterrupted reading, download the app