Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. which keyword used for differentiating local and global variable in java.

which keyword used for differentiating local and global variable in java.

Scheduled Pinned Locked Moved Java
java
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shiva kore
    wrote on last edited by
    #1

    hi, pls tell me. which keyword used for differentiating local and global variable in java. ************ S G KORE *******************

    J L T R 4 Replies Last reply
    0
    • S shiva kore

      hi, pls tell me. which keyword used for differentiating local and global variable in java. ************ S G KORE *******************

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      There is no such thing as global variables in java.

      1 Reply Last reply
      0
      • S shiva kore

        hi, pls tell me. which keyword used for differentiating local and global variable in java. ************ S G KORE *******************

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        All variables are defined by their scope, that is to say the block that contains them. Since no variable can exist outside a class there are no globals in Java. Take a look at the Java Tutorials[^] for more information.

        Just say 'NO' to evaluated arguments for diadic functions! Ash

        1 Reply Last reply
        0
        • S shiva kore

          hi, pls tell me. which keyword used for differentiating local and global variable in java. ************ S G KORE *******************

          T Offline
          T Offline
          TorstenH
          wrote on last edited by
          #4

          I agree to what the others wrote. There are some keywords in java you may not use as variable name: Java Language Keywords @ Oracle.com[^] But usually those words are highlighted in a special way as you use an IDE like Eclipse or Netbeans. regards Torsten

          I never finish anyth...

          1 Reply Last reply
          0
          • S shiva kore

            hi, pls tell me. which keyword used for differentiating local and global variable in java. ************ S G KORE *******************

            R Offline
            R Offline
            Ramaiah Raj
            wrote on last edited by
            #5

            Static can be used as a key word to differentiate instance variable and Class variable. But according to the place where its declared can determine whether its local variables or instance variables. But there is no global variables in java. public class DemoVariable { private static int a=0; //Class Variable private int b=0; // Instance Variable public void print() { int c =0; // local variable } }

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups