I made the following code in C ++:
#include <iostream>
template <typename type> class Foo
{
public:
Foo(type FooTest)
{
std::cout << "Foo " << FooTest;
}
};
int main
{
new Foo<double>(10.0);
}
Output: "Foo 10".
Java: (MainClass.java)
public class MainClass
{
public static void main(String[] args)
{
new Foo<Double>(10.0);
}
}
class Foo<type>
{
public Foo(type FooTest)
{
System.out.print("Foo ");
System.out.print(FooTest);
}
}
Output: "Foo 10.0".
This, just one case to demonstrate what happens, the output is different in both cases for double. How can I match them (Java = 10 and C ++ = 10.0)?