function arguments in java

function arguments in java

function arguments in java

View Answers

March 19, 2012 at 12:49 PM

Command line argument in Java

import java.util.*;
public class SumAndAverage{
public static void main (String [] arg) {
Scanner scan = new Scanner (System.in);
int [] numbers = new int [10]; 
int sum=0;
System.out.print("Enter 10 numbers");
for (int i=0; i<numbers.length; i++) {
numbers[i]=scan.nextInt ();
sum+=numbers[i];
}
System.out.println("Sum of Numbers: "+sum);
System.out.println("Average of Numbers: "+sum/10);
}
}

March 19, 2012 at 12:57 PM


March 19, 2012 at 4:03 PM

public class Swapping{
  static void swap(int i,int j){
  int temp=i;
  i=j;
  j=temp;
  System.out.println("After swapping i = " + i + " j = " + j);
  }
  public static void main(String[] args){
  int i=1;
  int j=2;

  System.out.prinln("Before swapping i="+i+" j="+j);
  swap(i,j);

  }
}

In the above code, the values of i and j are function arguments.









Related Tutorials/Questions & Answers:
function arguments in java
function arguments in java  function arguments in java   Command line argument in Java import java.util.*; public class SumAndAverage...); } } In the above code, the values of i and j are function arguments
List out different arguments in PHP header function?
List out different arguments in PHP header function?   List out different arguments in PHP header function
Advertisements
function error too many input arguments
function error too many input arguments  function error too many input arguments
how many max. arguments we pass to the any function ? how many max. arguments we pass to the any function ?
how many max. arguments we pass to the any function ? how many max. arguments we pass to the any function ?   how many max. arguments we pass to the any function
how many max. arguments we pass to the any function ?
how many max. arguments we pass to the any function ?   how many max. arguments we pass to the any function
arguments evaluation - Java Beginners
arguments evaluation   i am not sure about the evaluation order of arguments in java. can any one tell me that arguments in java is evaluated left... the arguments evaluated in C C
Passing Arguments. - Java Beginners
Passing Arguments.  Hi, im new in doing this passing arguments and calling methods. Can you please see that y im not getting the answer as the question says to do. Thanks Question:Write a method that is passed two arguments
Commandline arguments - Java Beginners
Commandline arguments  hi!My question is: Write a program to store the marks of 10 students in an array.Accept these marks as command line arguments and display their sum and average. Please respond as soon as possible.  
How to pass command line arguments in Java?
How to pass command line arguments in Java?  Hi, In a Java program I... it in a programming. How to pass command line arguments in Java? Share me the sample code. Thanks   Hi, You can use the String[] args of the main function in Java
PHP Function Arguments
. These arguments are local to the function and after performing some calculation... In general we pass the arguments to the function by value, whenever we pass the values... the variable as reference of the variable. PHP Function Arguments Example:ADS
XML clonning with java and passing arguments
XML clonning with java and passing arguments  Hi, I have a XML file as follows. My requirements are as below. 1. Clone the whole xml file. 2. Iterate depending on the number provided. Say 1 means only one set with arugments1
Command Line Arguments in Java Program
Command Line Arguments in Java Program       Java application can accept any number of arguments... command line arguments in java program.    */  
please tell me about command line arguments in java?
please tell me about command line arguments in java?  please tell me about command line arguments in java?   Hi Friend, The command-line arguments are the arguments which are sent to the program being called. You can
Java program to get the Command Line Arguments
Java program to get the Command Line Arguments       In java we can get the command  line arguments as they are provided on the console. In this example program our
please tell me about command line arguments in java?
please tell me about command line arguments in java?  please tell me about command line arguments in java?   Hi Friend, The command-line arguments are the arguments which are sent to the program being called. You can
mysql_connect arguments
mysql_connect arguments   How many arguments a mysql_connection function required to connect to the database?   ?mysql_connect? function takes three arguments Server - localhost Username - admin Password - 1admin
java password function
java password function  secret password function
JavaScript Array Arguments
in the function. In the given example, we have passed the arguments in the following way... JavaScript Array Arguments     ... which enables the programmer to tell how many arguments (or variables) are passed
Sum of two numbers using command line arguments in Java
Sum of two numbers using command line arguments in Java  Hi, How to pass two values as parameter from command line and the get in it Java program? The calculate the sum of two numbers using command line arguments in Java
hash function for java strings
hash function for java strings  hash function for java strings   int hash=7; for (int i=0; i < strlen; i++) { hash = hash*31+charAt(i
function to return value in java
function to return value in java  How to return maximum value in java?   Return Value in Java
Append Function in Java
Append Function in Java  What is the use of append function in java? How to use the append function to append a string to a buffer string. Thanks   You can use the StringBuffer class in Java to efficiently append
Java Code Color Function Error
Java Code Color Function Error  Java Code Color Function Error
JPA Substring() Function
() function. The substring() function returns the some part of string arguments. It takes three arguments. First is string argument that have to be concatenate... JPA Substring() Function   
JPA Upper Function
JPA Upper Function       In this section, you will learn about the JPA Upper() function. This function returns upper-case of the specified string arguments. JPA Upper
function
function  difference between function overloading and operator overloading
function 1 - Java Beginners
function 1  WAP to calculate the value of x,where x=tan(A)+tan(B)/1+tan(A)*tab(B)  Give more details like how to calculate and what is tan(A) and tan(B),etc
real+function - Java Beginners
real+function  <?php /** * @package WordPress * @subpackage Default_Theme */ if ( function_exists('register_sidebar') ) { register...="widgettitle">', 'after_title' => '</h2>', )); } function get
Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java
Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java  Q, 12 WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java
WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java
WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java  WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java   
WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java
WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java  WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java   
WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java
WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java  WAP to calculate addition of two distances in feets and inches using objects as functions arguments in java   
Main function.. - Java Beginners
Main function..  Hi Friend.. public static void main(String args[]) What does it mean...public - static - void - main -(String args[]) Can u plz explain Each n Every word... 1.String args[] DIFFERENCE
Command Line Arguments in Java
Command Line Arguments in Java The ongoing Java application can accept any... /** * How to use command line arguments in java program. */ class CmndLineArguments... arguments like: java CmndLineArguments Mahendra zero one two three OUTPUTADS
Equivalent function in java - Java Beginners
Equivalent function in java  Hi... I am going to convert my codings Visual c++ to java... I just want to know .. Do we have any function in java which equivalent to [ GetPixe() in Visual C++ ] ... thanks in advane
Java Function for block inside a block
Java Function for block inside a block  Write a function in Java that attempts to place a set of squares of varying widths into another, larger square. If there is no possible layout, return undefined. Otherwise, return
Java Function for block inside a block
Java Function for block inside a block  Write a function in Java that attempts to place a set of squares of varying widths into another, larger square. If there is no possible layout, return undefined. Otherwise, return
JavaScript pass arguments
JavaScript pass arguments   How to pass dynamic arguments to the functions in JavaScript
C/C++/JAVA Question on function
C/C++/JAVA Question on function  "Write a function to find out common alphabets between two arrays. Length of array is not fixed and may contain other data type also.ΓΆβ?¬Β? Question can be solved in C,C++ or JAVA
validation of strings using java function
validation of strings using java function  hi all, i am uploading data from csv file to data base where i took student id as string of length 6 char of the form abc123 will you please give me a function to validate this field
function call in javascript - Java Beginners
function call in javascript  hi all, i've written a javascript , but i m unable to call a function getExpression.i dont know why getExpression function is not being called. heres my code : function
main function in java - Java Interview Questions
main function in java  1....why is function main() define as static in java? 2...drawbacks of using rmi
command line arguments - Java Beginners
ModuleNotFoundError: No module named 'arguments'
ModuleNotFoundError: No module named 'arguments'  Hi, My Python... 'arguments' How to remove the ModuleNotFoundError: No module named 'arguments' error? Thanks   Hi, In your python environment you
java equivalent of c function htonl & htons
java equivalent of c function htonl & htons  hi is there any java equivalent for the c function htonl & htons
Java arraylist index() Function
Java arrayList has index for each added element. This index starts from 0. arrayList values can be retrieved by the get(index) method. Example of Java Arraylist Index() Function import
MySQL restore function in java - JDBC
MySQL restore function in java  I would like to import to a database .sql file. It is possible with the use of mysql administrator, however I would like to do the same with the use of java.Is it possible?If yes, how to do
Command line arguments
Command line arguments  Please explain me what is the use of "command line arguments" and why we need to use
COMMAND LINE ARGUMENTS
COMMAND LINE ARGUMENTS  JAVA PROGRAM TO ACCEPT 5 COMMAND LINE ARGUMENTS AND FIND THE SUM OF THAT FIVE.ALSO FIND OUT LARGEST AMONG THAT 5   Hi Friend, Try the following code: import java.util.*; class
Javascript Function - Java Interview Questions
function to validate the Date of birth field...it should check,leap year... in JSP var separator= "/"; var minYear=1900; var maxYear=2500; function...; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search

Ads