answersLogoWhite

0


Best Answer

It's rather confusing to try to describe the difference between these two. Let's look at an example of each.

A procedure in Java would be a method. It looks something like this:

void f(int n){

System.out.println(n);

}

A block in Java is any bit of code contained within curly braces {}

(Note that all methods must contain at least one block of code.)

// This is still a method.

void f(int n){ // This signifies the start of the method's main block of code

{// This is the start of another (inner) block of code

System.out.print(n);

System.out.println();

}// This closes the previous block

}// This closes the method's main block

The confusing part comes when trying to describe each one. All procedures (methods) in Java must be contained within a block of code - the class block. However, all procedures must also contain at least one block of executable code.

In conclusion: a block may be contained within a procedure and a procedure must be contained within a block.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between a procedure and a block in Java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Difference between procedure and function in C or C plus plus or Java language?

In C there are functions only, In Java methodsonly (static methods as well), in C++ both.


What is difference between java 2 and java 5?

They are different versions. Java 5 is newer than Java 2. Think of it like the difference between the Playstation 1 and the Playstation 3.


Major difference between c and java?

Java is object oriented, C is not...


What is the difference between connectivity in java?

kamina


What is difference between connectivity in java?

kamina


What is the difference between cc plus plus and java?

C is a procedure oriented language ,Where C++ & java are object oriented language.But java is platform independent.So generally C is called POP.C++ is called OOP.But java is OOP , which is platform independent.If java does not support primitive data type then it is called as pure object oriented language.


What is the main difference between UNIX and JAVA?

Unix is an operating system, Java is a language.


Difference between recordset and resultset in java?

Rowset


What is the difference between JAD and JAR?

JAD-Java Application Description JAR-Java archive


What is the difference between java and object oriented programming?

java is a programming language/platform that embodies object oriented programming concepts. The question of what is the difference is like asking what is the difference between cars and a Volvo.


What is the difference between c plus plus and java programming?

Java doesn't have pointers. C++ has pointers.


What difference between InputStreamReader and DatainputStream in java?

Both are same