Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

simple example of adding two number by calling a method

import java.util.Scanner;
class SumMethod{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.print("Enter the first number: ");
int num1=sc.nextInt();
System.out.print("Enter the second number: ");
int num2=sc.nextInt();
sc.close();
Sum(num1,num2); 
}
//Sum method
public static void Sum(int num_A,int num_B){
int sum=0;
sum=num_A+num_B;
System.out.println("Sum of two numbers  "+sum);
}
}
Comment

PREVIOUS NEXT
Code Example
Java :: kivy menu bar 
Java :: java add forward / at the end of not present 
Java :: stack overflow recyclerview 
Java :: javafx change application title 
Java :: select class field from list java 
Java :: List of tuple to map + jpa 
Java :: how to add new nod in dynamic treeview using javascipt 
Java :: java.lang.noclassdeffounderror: failed resolution of: lorg/apache/http/protocolversion; 
Java :: writing wehere clause in repository in springboot 
Java :: add element to arraylist of arraylist in java 
Java :: set countdown timer to play audio file android studio 
Java :: simple text formatter as in textbook 
Java :: stacks based on a linked list 
Java :: spring media part max size 
Java :: android api 21 join list of strings 
Java :: 4 byte timestamp java 
Java :: Which type of Exception will be thrown by forName() method 
Java :: multipleQuastion.Java 
Java :: java.lang.ArrayIndexOutOfBoundsException: -1 
Java :: change the default port in spring boot codegrepper 
Java :: paysimple 
Java :: andriod button wont change color 
Java :: java data table source tymeLeaf 
Java :: how to add element in java arraylit syntax in gfg 
Java :: java inetaddress workaround how to get localhost secure 
Java :: Print positive numbers from array 
Java :: how to make factorial in java recursive 
Java :: char array substring java 
Java :: They say that they have to create an instance to their application. What does it mean? 
Java :: correct lcd initialize 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =