Q:

How to get a value from another Java file?

First Java file:
public class Swordsman extends Beginner {
    public String attFunc;
    public String attSkill;
    private String nickname;
    private int power;
    private int result;

    public void setnickname(String nickname) {
        this.nickname = nickname;
    }

    public void setpower(int power) {
        this.power = power;
    }

    public Swordsman(int p, String nm) {
        setnickname(nm);
        setpower(p);
           /*nickname=nm;
            *power=p;
            */
    }

    public String nickname() {
        return nickname;
    }

    public int power() {
        return power;
    }

    public int result() {
        if (power >= bpower) {
            result = 1;
        } else if (power < bpower) {
            result = 0;
        }
    }
}

Second Java file:
public class Boss {
    public int bpower(){
        return bpower;
    }
}

Compile error:
.\Swordsman.java:32: error: cannot find symbol
        }else if(power<bpower){

As you see, I like to acces the bpower from the second Java file in the first Java file. How can I do that?

A:

I have a lot of trouble understanding the question. It seems that you lack the basic concepts of java as well as object oriented programming.
I will try to explain:

You have a class Swordsman, which can be instantiated to create swordsman objects. These objects will only see the content of itself.
You have a class Boss which completely stands by itself. And can be instantiated to create Boss objects.
If you want to have access to any of the values stored in a Boss object, you usually use getter and setter methods. Which you already have (the getter that is). Please be aware that you usually want to name these methods like getBpower() by convention. You did that on some methods, but forgot on others.
To actually be able to use that method, you need to import the class into your target class like import Boss; Then you would need to get an instance of that object from somewhere (either by getting it handed as a parameter or by creating it anew like Boss currentBoss = new Boss(); Then you can access your value like currentBoss.getBpower();
The Boss class however has no setter for the bpower and no constructor, where you set some default values to bpower. So the current Boss class is completely useless as bpower cannot have a valid int value.
There is also a lot of room for improvement regarding the architecture. You are on your way to start a god class. Your swordsman class starts doing stuff, that you might not expect it to do. Like calculating the outcome of a fight. 
By the way: A good habit is to name the methods on what they do. So result sounds like a property name (noun) while it is a method (verb). So getResult() would make some sense, even better would be boolean isFightAgainstEnemySuccessful(Enemy).

However, you might want to think twice on coding the combat logic into your character class. That stuff would be best in either a common class which all characters inherit from (here a beginner). 
Or you might even be better off by creating a singleton FightingMachine class that provides some utility methods like boolean FightingMachine.isCharacterWinningAgainstEnemy(Character, Enemy). 

As a rule of thumb: If you code an ability into a class that seems to be surprising, then it is probably wrong there. For an rpg, I would expect that the outer shell of the thing is some kind of gameState. Which then has control and storage of the environment, the characters and the enemies and initiates a fight, if needed. Not the other way around.

My actual proposition would be to actually learn the concepts of java before trying to code a roleplaying game. You will have much more fun then. I promise! 

