If i need to use same variables in several methods – should i define them on a class level or locally for each method?

I do not need to change the values of str1 and str2, so they are final. These variables are not a part of an object, they just need for some check inside the method1() and method2().

So not to repeat the code – is it ok to define them on class level or should i make them local?

class level:

private final String str1 = "";
private final String str2 = "";

private void method1() {
    // some stuff with 'str1' and 'str2'
}
private void method2() {
    // some stuff with 'str1' and 'str2'
}

or local:

private void method1() {
    final String str1 = "";
    final String str2 = "";
    // some stuff with 'str1' and 'str2'
}
private void method2() {
    final String str1 = "";
    final String str2 = "";
    // some stuff with 'str1' and 'str2'
}

Answer

If they are real constants (always the same value) then you can do:

private static final String MY_CONSTANT = "give me teh codez";

If they are initialized at object creation, and never modified, you can do:

public class MyClass {

    // This field cannot be updated after initialization
    // If it needs to be, then don't declare it as final. 
    private final String myField;

    // Note that the fields of this AnotherClass instance CAN
    // be updated, only the reference to this instance cannot
    private final AnotherClass anotherField = new AnotherClass();

    public MyClass(String fieldValue) {
        myField = fieldValue;
    }
}

In both these cases there is really no argument for keeping them as local variables.

However if the values are computed, received or updated after object creation there is a decision to be made about whether the value should be a field or not. Apart from the obvious design consideration (does the value conceptually make sense as a field of this class?) there are also pragmatic considerations. For instance some classes (e.g. controllers or services in most web application frameworks) have to be ‘stateless’ – they cannot store per-request state in their fields. You often see lots of parameters being passed between methods in such classes, which is a code smell. Solution could be to create a separate collaborating class like a Builder/Mapper/Handler/Processor to do a partial task on per-request data. After the task is done, the instance is discarded or reset. Within this collaborator you can put per-request data in fields and access it from different methods.

In general, methods should not have too many parameters. 1-3 parameters is fine. 4-7 is danger zone. More than 7 is definitely too much. See also this discussion and quoting Uncle Bob from his awesome book Clean Code:

The ideal number of arguments for a function is zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where possible. More than three (polyadic) requires very special justification—and then shouldn’t be used anyway.