Java — Cohesion in Java | Code Factory

class Multiply { 
int a = 5;
int b = 5;
public int mul(int a, int b)
{
this.a = a;
this.b = b;
return a * b;
}
}

class Display {
public static void main(String[] args)
{
Multiply m = new Multiply();
System.out.println(m.mul(2, 2));
}
}
4

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store