Questions about "*"

xiaoxiao2021-03-06  188

Question: Let's first take a look at a code class operatorer {float multiplication (float i, float j) {return i * j;} public static void main (string [] args) {float k = float.parsefloat Args [0]); float L = float.parsefloat (args [2]); // convert the string to float // char d = '*'; Operatorer o = new operatorr (); if (args [1] . Equals ("*")) // In addition to "*" does not have problems {p.rintln (Args [0] "multiplied" args [2] " O.MultiPlication K, L));}} ---------------------- Enter 3 * 3 (note, error occurred): --- --- Output -------- Exception in Thread "Main" java.lang.numberformatexception: for Input string: "a2.class" at sun.misc.floatingdecimal.readjavaformatstring (unknown Source) at java.lang .Float.Parsefloat (unknown source) at operatorer.main (Operatorer.java: 19) - = a2.class, is the first file in my current directory (the first file in the current directory) - = input 3 "*" 3 -------- Output -------- 3 multiply 3 get 9.0 ------------- -------- Why does this happen? I will not understand that I have seen similar discussions in a foreign forum: also started by a piece of code: public class mytest {public static void main (string [] args) {for (int i = 0; i

-------------------------------------- If you change to javac mytest "*", if you What is the desired output *, but this is? Some people say: ". Your command interpreter or shell is pre-interpreting the asterisk symbol in certain contexts / expressions" and "It is my windows command interpreter pre-interpreted the asterisk symbol", this issue, I made a simple experiment : ------------------------------------ in the command line: javac *. Class (or *); the results are as follows: Javac: Invalid Flag: aaa.class // this is My First Class File In Current DirectoryUsage: Javacwhere Possible Options include:

-g generate all debugging info

-g: None Generate No Debugging Info

-g: {Lines, Vars, Source} generate Only Some Debugging Info

-NoWarn Generate No Warnings

-verbose Output Messages About what the compiler is doing

-DepRecation Output Source Locations Where Deprecated Apis Are Used

-CLASSPATH

Specify WHERE to FIND USER CLASS FILES

-SourcePath

Specify where to find input source files

-bootclasspath

Override location of bootstrap Class Files

-extdirs

Override Location of Installed Extensions

-d

Specify WHERE to Place Generated Class Files

-ENCODING

Specify Character Encoding Used by Source Files

-Source

Provide Source Compatibility with Specified RELEASE

-Target

Generate Class Files for Specific VM Version

-Help Print A Synops of Standard Options

----------------------------------------------

When there is no Class file in my current directory, it will compile the Java file in all current directories.

-------------------------------------------------- -

My opinion is: Here, "*" represents wildcard in Windows. When you enter *, he is looking for it in your current directory.

Representative documents, you can see that he can represent all files, so when I entered "*" when I execute, the system will treat it as a wildcard, see the throwing error There is such a for input string: "a2.class", that is, a2.class

When SRTRING is incorporated into the program, but when the application is trying to convert a string into a numeric type, this string does not have the appropriate format.

Throw java.lang.Numberformatexception. If you must use *, you don't want to use his wildcard role, then please give

He plus double quotes. The second program in the article is actually equivalent to the DIR under the command, isn't it?

(But why don't you look for a class file first, you don't know, you know the people give an answer)

转载请注明原文地址:https://www.9cbs.com/read-128583.html

New Post(0)