Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: can using only static methods and fields be called as procedural paradigm?

Tags:

java

oop

Let's consider the following java program:

class Helper{
 public static int add(int a,int b){
  ....
 }
}

public class Calculator {
  public static void main(String[] args){
     System.out.println(Helper.add(5,10));
  }   
}

I mean if I use java but I don't create any instances of classes and in all classes I use only static methods and fields does it mean that I use procedural paradigm of programming but not object oriented?


1 Answers

Yes - I suppose that one could call that procedural programming. I imagine you will have static variables containing values which will be altered by the methods (this is what is meant by a side effect) so this style is not 'functional' programming which requires no side effects.

It seems like a strange thing to do - if you have a task that requires procedural programming use a procedural language.

It seems to me you are trying to use a chainsaw to hammer a nail in when there are perfectly good hammers around.

like image 175
Elemental Avatar answered Jul 25 '26 11:07

Elemental



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!