Is there any way to overload the assigment operator or it is not possible in java?
Thank you very much

No, it's not.
What is it that you want to achieve? - there may be other ways to get the desired result.

I am trying to translate a c++ code to java code and the class i am trying to translate it has overriding assigment operator. From what i have read there is no direct way to do it right? Also is there a way to have in a function default parameters? like void f(int x=0)?
Thank you very much

No, AFAIK there's no way (and quite right too!). There are no default params either, although you can overload the fn to have versions with and without the defaultable params (having come to Java from Smalltalk I do miss that one)

No overloading in Java, except what's already in the language (string concatenation by +, for example).

Default parameters you could do by overloading the method name.

public int bogusMethod()
{
  return bogusMethod(5);  //call this method using 5 as default
}

public int bogusMethod(int parameter)
{
  // do some calculation with parameter
  return result;
}

EDIT: James, we've got to stop meeting like this. :)

thank you very much for your help

if i write one class with template like this
public class lala<t>
{
typos a;
}
Who i can make a array like this? a= new <typos>[plithos];
The reason i want to do this is cause i want to make a class array from the begining

No sure I understand the question, but...

// define a reference variable a that points to a new array of typos objects (size = plithos )
typos[] a = new typos[plithos];

i think this is not acceoted in java. Am i wrong?

As long as typos is a Class and plithos is some kind of integer, that's good Java.

is it right to write a= (typos[]) (new Object[plithos]); or is something wrong with this?
Thank you

That looks like its trying to create a new array of Objects - that's OK
But then it tries to cast that to an array of typos's - which is not OK because Objects are not typos's.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.