Java Sample: Basic C# Application


Create and compile a basic C# application that shows a greeting message based on user’s name (which it should prompt for). The case when the user decides to provide no name should be handled as well.


In this sample we are going to create a basic application in C#. We will use NetBeans as the integrated development environment (IDE) of our choice (but of course you can use any other IDE out there that you are comfortable with – there will be no difference when it comes to the coding principles themselves).

Remember that before installing NetBeans, Java SDK needs to be installed first.

First of all, we will create a new project. For this, go to File → New Project (can be also accessed via Ctrl+Shift+N hotkey).

This will bring you to the project creation dialog window. On the left side you will see a tree of project types, where “Java” should be selected. On the right side there is list of available templates, with “Java Application” being the necessary one.

After pressing “Next”, name your project “TestProject”. The “Use Dedicated Folder for Storing Libraries” checkbox should be left unmarked, while the “Create Main Class” checkbox should be marked, with main class name being “testproject.TestProject”. By pressing “Finish” button, you will create the project.

After this, you will find the TestProject being added to Projects window (which is located in the upper left corner of workspace by default). By expanding TestProject tree nodes you can find the file, which needs to be edited in order to add any sort of functionality to our application. We are going to change that by adding the following code into “Main”:

Java sample

You can also write the comments to the code by marking them with //, ///, or /* */ . Let’s repeat the following code, now with the comments included.


So this is the code of our basic application, completed. Now to check how it works, we’ll need to compile it. In NetBeans, you only need to press F6 to compile the application and launch it in a console window to see the result.

If you like our Java sample or Heapsort Java example and want to order similar assignments from our experts, place an order with AssignmentShark, choose your subject, specify the instructions and your project will be completed within a specified deadline term.

Leave a Reply

Your email address will not be published. Required fields are marked *

Customer testimonials

Submit your instructions to the experts without charge.