By the information you give - no, a deadlock can't occur:
First, you don't mention multiple threads. A single thread can't cause a deadlock. But let's assume you have multiple threads.
So, if any other object, from different thread invokes some of these methods in reverse order, then a deadlock can occur.
The explanation of the situation is as follows: Thread-1
obtains the lock required to enter methodA
, and then tries to enter methodB
. If at the same moment another thread - Thread-2
invokes methodB
and obtains the lock for it, then tries to enter methodA
, but Thread-1
already has the lock, so Thread-2
waits. However, Thread-1
can't enter methodB
because Thread-2
has the lock. And they wait forever (deadlock).