Compiling error in Java

0 votes
I created a file name test.java which contains a class named Array. How can I compile and run this? Please help.
Mar 6, 2019 in Java by Prachi
524 views

1 answer to this question.

0 votes

Generally the file name and the class name must be same. Then again if they are different, even then you can compile your code.

javac filename.java
java classname


Hope this helps!

Check out Java certification course to become certified expert.

Thanks!

answered Mar 7, 2019 by Priyaj
• 58,020 points

Related Questions In Java

0 votes
1 answer

Lazy Initialization Error in Java

What is wrong here is that your ...READ MORE

answered Jan 14, 2019 in Java by developer_1
• 3,350 points
2,420 views
0 votes
1 answer

Dagger error in Java

What's going on? Have a good look at ...READ MORE

answered Feb 11, 2019 in Java by developer_1
• 3,350 points
3,789 views
0 votes
1 answer

Error: Unable to run mksdcard SDK tool in java?

Hello, If you use  Ubuntu, you can try: sudo apt-get ...READ MORE

answered Apr 9, 2020 in Java by Niroj
• 82,840 points
840 views
+1 vote
1 answer

Are arrays equivalent to objects in Java ?

Yes; the Java Language Specification writes: In the Java ...READ MORE

answered May 10, 2018 in Java by Rishabh
• 3,620 points
1,337 views
+1 vote
1 answer

Remove objects from an array in Java?

We can use external libraries: org.apache.commons.lang.ArrayUtils.remove(java.lang.Object[] array, int ...READ MORE

answered Jun 26, 2018 in Java by scarlett
• 1,290 points
1,198 views
+1 vote
1 answer

Performance difference of if/else vs switch statement in Java

The thing you are worried about is ...READ MORE

answered Jul 26, 2018 in Java by geek.erkami
• 2,680 points
3,760 views
+1 vote
3 answers

What is the syntax to declare and initialize an array in java?

You can use this method: String[] strs = ...READ MORE

answered Jul 25, 2018 in Java by samarth295
• 2,220 points
3,609 views
+17 votes
25 answers

How can I convert String to JSON object in Java?

Hi @Daisy You can use Google gson  for more ...READ MORE

answered Feb 7, 2019 in Java by Suresh
• 720 points
253,728 views
+29 votes
3 answers

How can we set java.library.path in Eclipse?

Go into the library settings for your ...READ MORE

answered Jul 3, 2018 in Java by sharth
• 3,370 points
22,405 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP