Local Variable In Java Programming With Code Example and Sample



Video: ClickMe

About Local Variable In Java Programming With Code Example Sample

LocalVariableInJava.java


package com.variables.tutorialbyexample;

public class LocalVariableInJava {

 public LocalVariableInJava() {
  // TODO Auto-generated constructor stub
 }

 public static void print() {
  int a = 50, b = 55, c = a + b;
  System.out.println("Output of print() method variable a = " +
  a + ", b = " + b + " and c =" + c);
 }

 public static void main(String[] args) {
  // Local Variables
  int a = 10;
  int b = 20;
  int c = a + b;
  System.out.println("Output of main() method variable a = " +
  a + ", b = " + b + " and c =" + c);

  //Calling the static print method
  print();

 }
}

Please like and share it!!!


3 comments:

  1. Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete

Please provide your input, it will honer for me...