Sponsored Content
Full Discussion: Java Date Class
Top Forums Programming Java Date Class Post 302924829 by durden_tyler on Wednesday 12th of November 2014 02:42:55 PM
Old 11-12-2014
Quote:
Originally Posted by DGPickett
...
I wonder, does an argument of '' (empty string) blow up or act like 0?
Looks like it blows up:

Code:
$
$ cat -n ParseInteger.java
     1  public class ParseInteger {
     2      public static void main (String[] args) {
     3          if (args.length == 1) {
     4              String strParam = args[0];
     5              System.out.println("Input string parameter                  = [" + strParam + "]");
     6              System.out.print  ("Integer value of input string parameter = ");
     7              System.out.println(Integer.parseInt(strParam));
     8          }
     9      }
    10  }
$
$ javac ParseInteger.java
$
$ java ParseInteger "-000456"
Input string parameter                  = [-000456]
Integer value of input string parameter = -456
$
$ java ParseInteger "-00"
Input string parameter                  = [-00]
Integer value of input string parameter = 0
$
$ java ParseInteger "+00"
Input string parameter                  = [+00]
Integer value of input string parameter = 0
$
$ java ParseInteger "000"
Input string parameter                  = [000]
Integer value of input string parameter = 0
$
$ java ParseInteger "1234"
Input string parameter                  = [1234]
Integer value of input string parameter = 1234
$
$ java ParseInteger "+123"
Input string parameter                  = [+123]
Integer value of input string parameter = 123
$
$ java ParseInteger ""
Input string parameter                  = []
Integer value of input string parameter = Exception in thread "main" java.lang.NumberFormatException: For input string: ""
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at ParseInteger.main(ParseInteger.java:7)
$
$

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running java class with a cron

Hello everybody, I have a problem about running a java class with a cron : I have Cron.txt file which has : 0,5,10,15,20,25,30,35,40,45,50,55 * * * * CronJava.txt I have CronJava.txt wihich has : cd ias/j2ee/SapAktarim/applications/SapAktarim/SapAktarim/WEB-INF/classes/;java -classpath... (3 Replies)
Discussion started by: UBGandalf
3 Replies

2. Shell Programming and Scripting

Function loading in a shell scripting like class loading in java

Like class loader in java, can we make a function loader in shell script, for this can someone throw some light on how internally bash runs a shell script , what happenes in runtime ... thanks in advance.. (1 Reply)
Discussion started by: mpsc_sela
1 Replies

3. Shell Programming and Scripting

call constructor of java class in script

Hi, Is it possible to call the constructur of a java class in a shell script? I know you can call static methods, but can you also call the constructor? tnx. (1 Reply)
Discussion started by: thebladerunner
1 Replies

4. Fedora

Help, how to dynamicly load java class

Hi, everyone: I'm trying to connect to DB using JDBC on fedora. I have successfully installed jdk and it's ok to run common java program. The environment variables: JAVA_HOME=/installed/mycoy/jdk1.6.0 PATH=$JAVA_HOME/bin:$PATH... (3 Replies)
Discussion started by: mycoy
3 Replies

5. Programming

how abstract class differs in Java and C++?

hello all, i want to know if there is any difference in working and syntax declaration of abstract class in Java and C++. (1 Reply)
Discussion started by: haravivar
1 Replies

6. Programming

Help in JAVA main and class

Is anyone know how to write a class in separate file? While method does it needs to be contained in a printwriter class? Can I have the format of the printwriter class as a reference? Thanks a lot. (1 Reply)
Discussion started by: eel
1 Replies

7. Programming

Link array to class java

Hi, I need help to Link array from one class to another class Firstly CSVParser Class what it did is load csv file and store into array Secondly WarehouseItem where each record is store How can I get a list of array that I load to CSVParser Class and store them to WarehouseItem and... (0 Replies)
Discussion started by: guidely
0 Replies

8. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies

9. Programming

Simplify setter and getter of java class

I am trying to verify my understanding on setter and getter on java class with this example: //MaximumFinder2.java import java.util.Scanner; public class MaximumFinder2 { public static void main (String args) { Scanner input = new Scanner(System.in); ... (6 Replies)
Discussion started by: yifangt
6 Replies
zemberek-server(8)					      System Manager's Manual						zemberek-server(8)

NAME
zemberek-server - Turkish spell-checker server SYNOPSIS
zemberek-server [CONFILE] or java -jar /usr/share/java/zemberek-server.jar [CONFILE] DESCRIPTION
zemberek-server is a Java(TM) based ``Turkish'' spell checker daemon which listens a configured port (by default, 10444) for client connec- tions and responds with the Turkish spell checked output in a server-client fashion. zemberek-server uses Zemberek, a Java(TM) based Turk- ish NLP library, at its heart. Certain parts of the servers' behaviour can be controlled in the CONFILE configuration file. For example, to change the listened port one can use the SERVER_PORT setting in CONFILE. OPTIONS
There are no options. NOTES
To make use of the server, a client program is required (see the next section). FILES
/etc/zemberek-server.conf configuration file /var/log/zemberek-server.log server's log file when running in the background SEE ALSO
zpspell(1) the website for further information <https://zemberek.dev.java.net/> AUTHOR
Zemberek Team: Ahmet A. Akin <ahmetaa@gmail.com> and Mehmet D. Akin <mdakin@gmail.com> This manual page was written by Recai Oktas <roktas@debian.org> for the Debian GNU/Linux system, but may be used by others. Debian/GNU Linux February 2006 zemberek-server(8)
All times are GMT -4. The time now is 03:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy