Q:

Why doesn't both these codes give the same output?

So I want draw a field (of array strings) with obstacles and free spaces. "+" are the obstacles and free spaces are just "". And if we have a free space, I want it replaced by "*". I will choose one specific element of that 2d array that equals "" and that will be replaced by "1".
My question isn't as long as it seems, you could ignore the 2 codes below. Here is summary, if unclear, please read to the end:
Why aren't these things equal to each other?
if(field[i][j]==field[5][1]){
  System.out.print("1");
}

and
if(i==5 && j==1){
   System.out.print("1");
}

First code doesn't work. That specific array element here will be field[5][1] which I want replace by 1:
public class Test{
    public static void main(String[] args){

        String[][] field = {{"+" , "+" , "+" , "+" ,"+" , "+" , "+"},
                            {"+" , "+" , "+" , "+" ,"+" , "" , "+"},
                            {"+" , "+" , "+" , "+" ,""  , ""  , "+"},
                            {"+" , "+" , "+" , ""  ,""  , "+" , "+"},
                            {"+" , ""  , ""  , ""  ,"+" , "+" , "+"},
                            {"+" , ""  , "+" , "+" ,"+" , "+" , "+"},
                            {"+" , "+" , "+" , "+" ,"+" , "+" , "+"}};
        int x = field.length;

        for(int i=0; i<x; i++){
            for(int j=0; j<field[i].length; j++){
                System.out.print(field[i][j]);

                if(field[i][j] != "+"){
                    if(field[i][j]==field[5][1]){
                        System.out.print("1");
                    }
                    else{
                        System.out.print("*");
                    }
                }
            }
            System.out.println("");
        }
    }
}

Output:
+++++++
+++++1+
++++11+
+++11++
+111+++
+1+++++
+++++++

Second code works as desired:
public class Test{
    public static void main(String[] args){

        String[][] field = {{"+" , "+" , "+" , "+" ,"+" , "+" , "+"},
                            {"+" , "+" , "+" , "+" ,"+" , "" , "+"},
                            {"+" , "+" , "+" , "+" ,""  , ""  , "+"},
                            {"+" , "+" , "+" , ""  ,""  , "+" , "+"},
                            {"+" , ""  , ""  , ""  ,"+" , "+" , "+"},
                            {"+" , ""  , "+" , "+" ,"+" , "+" , "+"},
                            {"+" , "+" , "+" , "+" ,"+" , "+" , "+"}};
        int x = field.length;

        for(int i=0; i<x; i++){
            for(int j=0; j<field[i].length; j++){
                System.out.print(field[i][j]);

                if(field[i][j] != "+"){
                    if(i==5 && j==1){
                        System.out.print("1");
                    }
                    else{
                        System.out.print("*");
                    }
                }
            }
            System.out.println("");
        }
    }
}

Output: 
+++++++
+++++*+
++++**+
+++**++
+***+++
+1+++++
+++++++

A:

The two are obviously different:
if(field[i][j]==field[5][1]){

Is true if field[i][j] is "" - and there are lots of array elements equal to that.
if(i==5 && j==1){

is true if i == 5 and j == 1 - which is only true at 1 position.

It should be noted that the first approach is not a reliable way to compare strings: it is only because of the way that you construct field that the code currently behaves as it does. In general, you should use field[i][j].equals(field[5][1]). See How do I compare strings in Java.

