answersLogoWhite

0


Best Answer

The fundamental structure of any Java programme should look like:

[package declarations]

[import statements]

[class declaration]

An example is given below:

package abc;

import java.lang;

class Demo {

public static void main(String[] args) {

Sytem.out.println("Hello! World");

}

}

//The file containing this class must be named Demo.java

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

A Typical Java class would have the following.

Package statement

import statements

Class comments (Optional)

Class Declaration {

Instance variable declarations

Constructor declaration

Method declarations

}

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

A Typical Java class would have the following.

Package statement

import statements

Class comments (Optional)

Class Declaration {

Instance variable declarations

Constructor declaration

Method declarations

}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Let us see now how the simple java program will look like.

You can use any editor like notepad or any Java IDE for writing java programs.

/*

This is a sample java program

Save this file as Welcome.java

*/

class Welcome

{

// A java program will start from here.

public static void main(String args[])

{

System.out.println(" Welcome to Java-Sample!!! ");

}

}

For those who are using the IDE, you can follow the instructions have given by there.

Suppose if you are entering your program in notepad, then save this file as Welcome.java

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

The structure of Java Program are as under

1) Package

2) Class declaration

3) Method declaration

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Explain the structure of a java program?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


What is java program made of?

basic unit of C is structure like procedure ,syntax's, error's compiler etc


What is java virtucal mechine?

That refers to the program that runs the compiled Java program.


Explain the role of sizeof operator in java?

There is no sizeOf() operator in Java.


What is a Java applet?

PCH answer small Embedded Java Program.

Related questions

What is a java programming?

A java program is a program that is coded and run in the programming language called java. Java is similar to c++ in structure, and is more common in web apps. C++ is the equivalent for more heavy duty programs such as most software used to compose a java program.


What do you mean by multithread program in java?

A Program in Java that spawns multiple threads is called a multithreaded program in Java.


What is java program made of?

basic unit of C is structure like procedure ,syntax's, error's compiler etc


What is java program on computers?

#!/usr/bin/perl print 'java program';


What is java virtucal mechine?

That refers to the program that runs the compiled Java program.


Where can one find more information on Java car rental?

Java Car Rental is an opensource program which you can find on various forums across the net, though the best place to learn how to create this program is Rose India. They offer the code and explain the variables you can tweak for your business - it is actually quite simple, and there are various places to go for tutorials that explain how you can tweak this program to your liking.


What powder game doesnt need java?

Any program written for the Java technology needs Java. Any program NOT written for Java DOESN'T need it.


Java Track?

Java Track is the java training program offered by SynergisticIT


Where can one get the program Java?

The program Java can be downloaded from the official Java website on the internet. The program is free for personal use, so it can be downloaded without any cost by anyone.


Explain the role of sizeof operator in java?

There is no sizeOf() operator in Java.


What is a Java applet?

PCH answer small Embedded Java Program.


Do I need Java?

No, if a program needs Java it'll specify that it does in the installer package for the program or on the website for the program or a section usually called "Requirements" for a specific program.