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.

Ads









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
function error too many input arguments
function error too many input arguments  function error too many input arguments
Advertisements
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
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
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... 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 password function
java password function  secret password function
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
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
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
function to return value in java
function to return value in java  How to return maximum value in java?   Return Value in Java
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
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
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
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
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   
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
Command Line Arguments in Java
Command Line Arguments in Java The ongoing Java application can accept any... command line arguments in java program. */ class CmndLineArguments { public... of the program: Run program with some command line arguments like: 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
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
JavaScript pass arguments
JavaScript pass arguments   How to pass dynamic arguments to the functions in JavaScript

Ads