Tuesday, 28 November 2017

Code Structure in Java

Source file

Source file holds one class definition. The class represents a piece of your program, although a very tiny application might need just a single class. Source file code with .java extension .

Class 

Java class file is a file (with the .class filename extension) containing Java byte code that can be executed on the Java Virtual Machine (JVM). A Java class file is produced by a Java compiler from Java programming language source files(.java files) containing Java classes.The class must go with a pair of curly braces({}). A class has one or more methods.

Method

method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method's name. Think of a method as a subprogram that acts on data and often returns a value. Each method has its own name. Method code is basically a set of statement and for now you can think a method kind of like a function or procedure.

No comments:

Post a Comment