Difference Between Java and C++


Java C++
import java.util.Scanner; #include<iostream>
import java.lang.Math; #include<math.h>
Using namespace std;
class hi
{
public static class Ead Class Ead
{ {
public:
void sqroot(float num) void sqroot(float num)
{ {
System.out.println (“aans=”+Math.sqrt(num)); cout<<"Square root = " << sqrt(num);
} }
}; };
public static void main(String [] args) main()
{ {
Ead obj = new Ead(); Ead obj;
Scanner a = new Scanner(System.in); int num;
cin>>num;
Int num = a.nextInt();
obj.sqroot(num); obj.sqroot(num);
} }
}