Home Answers Viewqa Java-Interview-Questions How to invoke method of a library from command line

 
 


Vijay
How to invoke method of a library from command line
2 Answer(s)      a year and 4 months ago
Posted in : Java Interview Questions

Suppose there are two methods in a libray and you have to invoke one of the method from that library directly from the command prompt.

How will you do it?

View Answers

January 6, 2012 at 1:32 PM


import java.util.*;
class JavaMethod 
{
    public static void main(String[] args){
        Scanner input=new Scanner(System.in);
        System.out.print("Enter Number1: ");
        int num1=input.nextInt();
        System.out.print("Enter Number2: ");
        int num2=input.nextInt();
        int  maximum=Math.max(num1,num2);
        System.out.println("Largest is: "+maximum);
    }
}

January 6, 2012 at 3:17 PM


This is not exactly what am I looking for.

Here you are invoking the method with in the code, not from the command prompt directly.

Here just the two numbers are read from command prompt only, nothing specific to invoking method from Command prompt.

Same we can use with args of main method. Based on the the type of input we can invoke the method from code.

My concern is that is there any way to invoke method of library directly from Command Prompt?









Related Pages:
How to invoke method of a library from command line
How to invoke method of a library from command line  Suppose there are two methods in a libray and you have to invoke one of the method from that library directly from the command prompt. How will you do
What is command line argument in Java
of arguments from the command line. Arguments are passed as a string array...What is command line argument in Java  What is command line argument... example of command line argument program in Java?? It will be really helpful
How To Read String From Command Line In Java
How To Read String From Command Line In Java In this section we will discuss about how string can be read through the command line. In Java command line... demonstrates that how to take input from command line. Here in this example we
Java Command Line Input
Java Command Line Input  How to get input from command line in java ?   Hi please Find the code for inputting data from the command line System.out.println("Please Input A Number"); BufferedReader br
How to run PHP Script from the command line ?
How to run PHP Script from the command line ?  Running PHP Script from the command line   Actually it is very simple to run php script command line. Except there are a few things that are different, for example
How To Read Integer From Command Line In Java
How To Read Integer From Command Line In Java In this section we will discuss about how an integer can be read through the command line. In Java all... value from the command line. In this example I have created a class named
Java memory options from command line
Java memory options from command line  Hi, How to use java memory options from command line? Thanks   Hi, Here is the example code: java -Xms1056m -Xmx1056m MyProgram Thanks
PHP invoke Method
functions. __invoke() is one of them. The functionality of __invoke() method... of __invoke() method it is possible and just because of it's magical property... is it actually and how it works? Hope the following example will exemplify: PHP Invoke
Command Line Standard Input In Java
about how standard input can be read through command line in Java...Command Line Standard Input In Java In this section we will discuss about the Java IO Standard Input through Command Line. Standard streams, feature
command line arguments - Java Beginners
command line arguments  how can i findout the minimum and maximum no's at the command prompt if i give some values?????????  hi friend... at the command prompt and then calculate the max and min numbers from them
How to Check Markup in PHP File from Command Line
How to Check Markup in PHP File from Command Line  Check Markup in PHP File from Command Line   PHP has a feature that allowed you to check... try this: http://www.phpzag.com/check-markup-in-php-file-from-command-line
execute a PHP script using command line
execute a PHP script using command line  How can I execute a PHP script using command line?   Hi friends, Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line
How to Checking Syntax Error in PHP from Command Line
How to Checking Syntax Error in PHP from Command Line  Checking Syntax Error in PHP from Command Line   PHP allows you to check your script... check this: http://www.phpzag.com/checking-syntax-error-in-php-from-command-line
PHP Invoke Method
__invoke(): PHP 5.3.0 has introduced lots of new methods,  __invoke() is one of them. The purpose of __invoke() method is different from others..., let's try to evaluate what is it actually and how it works? Hope
Java I/O From the Command Line
Java I/O From the Command Line In this section we will learn about the I/O from the command line in Java. Several times you can see that the programs runs after taking the input from the command line. Java also supports for the command
Passing Command Line Arguments
pass values on command line argument . We are taking a sequence of character from command line at run time. Store these strings into an array... Passing Command Line Arguments     
Passing argument at command line using Core Java
How to pass Command Line Argument using Core Java Description : This example demonstrate how value accepted from the command line. All argument need to placed at the command line at the time of executing your program.  class
Command Line Arguments in Java Program
directly from the command line. The user can enter command-line arguments when...    /**    * How to use command line... Command Line Arguments in Java Program   
Compiling package in command line
Compiling package in command line  Hi friends, i am totally new to java programming, i am basic learner in java. My query is, How to compile java package using command line. For Eg: When i compile following command, c:>set
Help on mySQL 5 command line - SQL
) from dictionary to display the output of the least word search result. But how...Help on mySQL 5 command line  Dear Sir, I had created a table for mySQL 5 called dictionary as shown below: mysql> select * from dictionary
help on mySQL 5 command Line - SQL
help on mySQL 5 command Line  Dear Sir, Sorry for my mistake... called dictionary as shown below: mysql> select * from dictionary... | +----+------+-------------------------?Ebr /> I want to use the command SELECT WORD, MIN(num
Printing Command Line arguments in JRuby
also take arguments from the command line into our JRuby program.  This example will illustrate you how to take command line arguments in JRuby program... Printing Command Line arguments in JRuby
Repairing mysql database from command line
Repairing mysql database from command line  Hi, Can anyone tell me the process for repairing mysql database from command line? Thanks
How To Unblock IP address from command line in CSF Firewall ââ?¬â?? Linux Server?
How To Unblock IP address from command line in CSF Firewall ΓΆβ?¬β?? Linux Server?  Hi, How To Unblock IP address from command line in CSF Firewall... /etc/csf/csf.deny using vi editor. Command is: vi /etc/csf/csf.deny Remove
ALL command - SQL
are the arguments passed to the main() method of For command help type 'help' at jdb... is a command line program to run Java applets. It is included in the SDK...ALL Command in Java & SQL  Nee all commands in Java.  Dear
how to pass command line arguments in ant
how to pass command line arguments in ant  How to pass runtime values ie commandline arguments to a program written in java using ant tool
Invoke Method in Java
Invoke Method in Java     ... in the program to invoke the methods. As you can see here we are using reflect method... will show you, how to declare and invoke the methods in Java.   
Command line arguments
Java application can accept any number of arguments directly from the command line. The user can enter command-line arguments when invoking the application. When running the java program from java command, the arguments are provided
Compiling and Running Java program from command line
Compiling and Running Java program from command line - Video tutorial... of compiling and running java program from command line. We have also video... the process of compiling and running the Java program from command prompt
Command line argument in java
to the command line. It accept into the string argument of main method. Command...Command line argument in java. In this section we are going to discuss about command line argument in java. Command line argument allow a user to pass
How to read a line from a doc file
How to read a line from a doc file  How to read a line from a doc file   Hi Friend, To run the following code, you need to download POI library. import java.io.*; import org.apache.poi.hwpf.HWPFDocument; import
Developer Open Source Library
provides a command-line interface that can be used to automatically install..., its documentation and examples from Sourceforge.The library's developers blog...Developer Open Source Library Introduction of moo.fox moo.fx
How can I execute a PHP script using command line?
How can I execute a PHP script using command line?  How can I execute a PHP script using command line
How to read big file line by line in java?
Learn how to write a program in java for reading big text file line by line In this tutorial I will explain you how you can read big file line by line... of an array. readLine() - This method is used to read a complete line
Command Line Standard Error In Java
Command Line Standard Error In Java In this section we will discuss about the Command Line Java IO Standard Error. System.out and System.err both... example which will demonstrate about how Standard Error can be printed
Command Line Standard Output In Java
Command Line Standard Output In Java In this section we will discuss about the Command Line Java IO Standard Output. Standard streams, feature of various O... given which will demonstrate you about how standard output can be written
Java read file line by line
class is used to read text from a file line by line using it's readLine method...Java read file line by line In this section, you will learn how to read a file... are going to read a file line by line. For reading text from a file it's better
Command line arguments
Command line arguments  Please explain me what is the use of "command line arguments" and why we need to use
Invoke EJB 1.1 through Web Services - WebSevices
Invoke EJB 1.1 through Web Services  I want to know how to invoke remote method in EJB 1.1 through WebServices in OC4J server i.e (9.0.4). I am using Eclipse 3.5 and JDK 1.3. Please help. It is very critical and urgent. Any
How to extract a specific line from a text file? - IoC
How to extract a specific line from a text file?  Hi all, i'm trying to write a code that return a specific line from a text file. so my first..., it's working fine and it's from Roseindia tutorial. But now, i want to extract the line N
Read Specific Line from file Using Java
Read Specific Line from file Using Java Here we are going to read a specific line from the text file. For this we have created a for loop to read lines 1 to 10 from the text file. If the loop reached fifth line, the br.readLine() method
iPhone Pick images from Photo Library
iPhone Pick images from Photo Library In this example application we are going to show you how to pick an image from photo library. To choose the photo from the photo library we required to call three different delegates
character as command line arguments
character as command line arguments  public class testing { public static void main(String args[]) { char a; a=args[0]; System.out.println("character is:"+a); } } what will be the above program output
How to extract the entire line with specific data from a Text in java?
How to extract the entire line with specific data from a Text in java?  Hi, i would like to extract data from text like the following one: [CODE... my prog? i know how to read specific line from text with the lineNumber
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
Class path
; The Classpath is an argument that is path through the command line. Classpath can...... where: sdkTool: It is a command-line tool, similar to javadoc, javac and classpaths... that is enclosed in a Jar file called Mylib.jar then we have to use the command line option
Java file line reader
Java file line reader In this section, you will learn how to read a particular line from file. Sometimes you want to read a particular line from the file.... When loop reaches the third line, the br.readLine() method of BufferedReader
Java program to get the Command Line Arguments
Java program to get the Command Line Arguments... program we can use the string array variable args for holding command line...; Getting command line arguments -- Argument [1] is = Amit Argument
Java Write To File By Line
Java Write To File By Line In this tutorial you will learn how to write to file by line Write to a file by line using java you can use the newLine() method of BufferedWriter class. newLine() method breaks the continuous line
line chart from database in jsp
line chart from database in jsp  how can i create line chart from database in jsp code

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.