Very simple java program not working

In summary, the conversation revolves around a person struggling to print a message using the Netbeans IDE and encountering an error. They are attempting to incorporate a database and SQL queries into their Java program but are struggling due to their limited knowledge in the language. A helpful tidbit is given about the case-sensitivity in Java and the correct way to use the System.out.println() method. The person expresses their frustration and may come back for more help.
  • #1
camel-man
76
0
I am using the netbeans IDE

All I am trying to do is print out to the screen, but I keep getting this error.

Code:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: system.out.println
	at mysqlconn.mainhgf4.main(mainhgf4.java:19)

Here is my short code

Code:
package mysqlconn;
import java.io.BufferedReader;
/**
 *
 */
public class mainhgf4{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
       system.out.println("Welcome friend!");
    }
}

This is not really a java program, it is a SQL program that I am supposed to somehow implement a DB in java... IDK I am so frustrated over this. I am originally a C programmer and have very basic knowledge of java, but the fact that I have to incorporate a database and SQL queries is making this impossible for "ME", I know a lot of people can do this with their eyes closed.
 
Technology news on Phys.org
  • #2
Try System.out.println(...)
 
  • #3
Java is a case-sensitive language, and by convention, class names (like System), start with an upper-case letter, whereas variable and method names start with a lower-case letter (like out & println() )
 
  • #4
Ahh wow that was simple lol thank you, I might be back for more questions because if I had trouble with that then there is no telling how many problems I am going to run across lol
 
  • #5


I understand your frustration with encountering errors in your code. It can be frustrating when our programs do not work as intended. In this case, it seems like there may be a syntax error in your code. The error message indicates that there is an issue with the "system.out.println" statement. In Java, the correct syntax is "System.out.println" with a capital "S" in "System". Double-check your code to make sure this is corrected.

Additionally, it seems like you are trying to incorporate a database and SQL queries into your Java program. This may require some additional knowledge and understanding of both Java and SQL. I suggest seeking out some online tutorials or resources to help guide you through the process. You can also try reaching out to more experienced Java programmers for assistance or guidance.

Remember, programming can be challenging, but with persistence and determination, you can overcome these obstacles and successfully implement your program. Good luck!
 

1. Why is my simple Java program not running?

There could be several reasons why your simple Java program is not running. Some common issues include syntax errors, incorrect file paths, missing libraries, or improper use of variables. It is important to carefully review your code and check for any errors that may be causing the program to fail.

2. How can I fix a "class not found" error in my Java program?

A "class not found" error can occur if the Java program cannot find the specified class. This can be fixed by making sure the class name and file path are correct, and that the class is properly imported and referenced in the code. Additionally, check for any typos or spelling errors in the class name.

3. Why is my Java program only printing a blank screen?

If your Java program is only printing a blank screen, it could be due to a missing or incorrect print statement. Make sure that you are using the correct syntax for printing and that all necessary variables or data are included in the print statement.

4. How can I debug my Java program?

To debug a Java program, you can use a debugger tool or add print statements throughout your code to track the flow of execution and identify any errors. You can also use try-catch blocks to catch and handle any exceptions that may occur during runtime.

5. My Java program was working before, but suddenly stopped. What could be the cause?

If your Java program was previously working but has suddenly stopped, it could be due to changes in the code or environment. Make sure to check for any recent updates or changes that may have affected the program. It is also possible that a previously unnoticed error is now causing the program to fail.

Similar threads

  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
2
Views
602
  • Programming and Computer Science
Replies
3
Views
765
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
1
Views
735
  • Programming and Computer Science
Replies
14
Views
3K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
9
Views
2K
  • Programming and Computer Science
Replies
2
Views
12K
Back
Top