Quantatask
  • For Companies
  • Log In
    As a user
    As a company
  • Sign Up
    As a user
    As a company
  • About
  • Community
  • Contact
  • Blog
  • join our discord
  • For Companies
  • Log In
    • Log In as a User

      Learn to code for free and complete programming tasks

    • Log In as a Company

      Post tasks and find talented freelancers to complete them

  • Get Started ❯
    • Sign Up as a User

      Learn to code for free and complete programming tasks

    • Sign Up as a Company

      Post tasks and find talented freelancers to complete them

Development Environment


2. Main program body


The body for a program named "Example" is as follows:

public class Example {
    public static void main(String[] args) {
        // program code
    }
}
    

The program is stored in a text file named after the program with the .java extension. For a program named Example, the file should be named Example.java.

The execution of the program begins at the part marked with the // program code comment above. During our first week of programming, we will limit ourselves to this part. When we are talking about commands such as printing, we need to write the commands into the program body. For example: System.out.print("Text to be printed");

public class Example {
    public static void main(String[] args) {
        System.out.print("Text to be printed");
    }
}
    

From this point on, the main program body will be omitted from the examples.


3. Getting to know your development environment


Programming these days takes place in development environments almost without exceptions. The development environment provides several tools and features to assist the programmer. Although the development environment does not write the program on behalf of the programmer, it contains several handy features such as hinting about mistakes in code and assisting the programmer to visualize the structure of the program.

In this course, we will use the NetBeans development environment. A guide for using NetBeans is available here.

Until you become familiar with NetBeans, follow the guides and steps precisely. Most of the following exercises show what needs to be printed to the screen for the program to function correctly.

Note: Do not do the exercises by writing code and then clicking the test button. You should also execute the code manually (green arrow) and observe the result on the screen. This is especially useful if an exercise fails to pass the tests.

In the following exercises, we will practice the use of NetBeans and printing of text on the screen.

Remember to read the guide on using NetBeans before you continue!

Exercise 1: Name

Create a program that prints your name to the screen.

The program output should resemble the following:

Jane Doe
        

Exercise 2: Hello world! (And all the people of the world)

Create a program that prints out the following:

Hello world!
(And all the people of the world)
        

Exercise 3: Spruce

Create a program that prints the following:

    *
   ***
  *****
 *******
*********
    *
        

Note: You probably wrote System.out.println("...") quite a few times. Try typing only sout on an empty line in NetBeans and then press the tab key. What happened? This tip will save a lot of your time in the future!

Development Environment


2. Main program body


The body for a program named "Example" is as follows:

public class Example {
    public static void main(String[] args) {
        // program code
    }
}
    

The program is stored in a text file named after the program with the .java extension. For a program named Example, the file should be named Example.java.

The execution of the program begins at the part marked with the // program code comment above. During our first week of programming, we will limit ourselves to this part. When we are talking about commands such as printing, we need to write the commands into the program body. For example: System.out.print("Text to be printed");

public class Example {
    public static void main(String[] args) {
        System.out.print("Text to be printed");
    }
}
    

From this point on, the main program body will be omitted from the examples.


3. Getting to know your development environment


Programming these days takes place in development environments almost without exceptions. The development environment provides several tools and features to assist the programmer. Although the development environment does not write the program on behalf of the programmer, it contains several handy features such as hinting about mistakes in code and assisting the programmer to visualize the structure of the program.

In this course, we will use the NetBeans development environment. A guide for using NetBeans is available here.

Until you become familiar with NetBeans, follow the guides and steps precisely. Most of the following exercises show what needs to be printed to the screen for the program to function correctly.

Note: Do not do the exercises by writing code and then clicking the test button. You should also execute the code manually (green arrow) and observe the result on the screen. This is especially useful if an exercise fails to pass the tests.

In the following exercises, we will practice the use of NetBeans and printing of text on the screen.

Remember to read the guide on using NetBeans before you continue!

Exercise 1: Name

Create a program that prints your name to the screen.

The program output should resemble the following:

Jane Doe
        

Exercise 2: Hello world! (And all the people of the world)

Create a program that prints out the following:

Hello world!
(And all the people of the world)
        

Exercise 3: Spruce

Create a program that prints the following:

    *
   ***
  *****
 *******
*********
    *
        

Note: You probably wrote System.out.println("...") quite a few times. Try typing only sout on an empty line in NetBeans and then press the tab key. What happened? This tip will save a lot of your time in the future!