First test java

xiaoxiao2021-03-05  22

This semester school has opened a Java elective class, but he has never been going on.

Mainly, the teacher said that it is too passionate to listen to him.

A few days, because some things need to use Java, they finally put JDK.

In fact, when writing this article, it is no longer a first trial.

Because it is installed on the JDK, I wrote a HelloWorld according to the practice.

There is a little feeling for Java.

However, the Java compiler check is too strict, it is very uncomfortable.

I also have a unknown premonition - will definitely worry about debugging Java programs.

I don't think so far this day is so fast.

I was still in the coding theory class this morning, my girlfriend sent a text message, let me help her with Java write a quick sorting program.

This is a bit difficult to fell. After all, I used Java and just wrote a HelloWorld.

Basically, what is also known

However, since it is a girlfriend, I have to try again.

So the class immediately returned to the bedroom.

The program writes to a smooth foaming method or it is difficult to fall.

But bigger problems are still behind

I used Javac to compile together with Java as follows, the source program is as follows:

Public class sort {public static void main (string args []) {int Arr [] = {95, 23, 45, 66, 79, 84, 100, 54, 87, 67, 94, 81, 83, 76, 84, 66 88, 91, 25, 77, 84, 22, 56, 78, 49, 83, 89, 86, 84, 44};

For (int i = 0; I

Perform C: /> Javac Sort.java everything is normal

Then execute again

C: /> java sortexception in thread "main" java.lang.ArrayindexOutofboundsexception: 30 at sort.main (Sort.java: 11)

Old is wrong, I have to be depressed.

I am not very familiar with Java. I am in order to facilitate the things you want to realize in the main () function.

I don't know if there is any problem, I haven't checked it yet.

I have tried many times in other ways.

If you change the definition of the array:

Int arr [] = new int rt [30];

Arr [0] = 45; Arr [1] = ...

The result is still

I checked some information on the Internet. I have exactly the same way as the definition above, but I have to be big.

I didn't expect to write a small program with Java to be so depressed.

I am bitter.

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

New Post(0)