Would it be right to say that if Joseph K. had learned law, he wouldn't have had to go through so much hardship in The Trial?
No, that would not be right. That's like asking If a doctor knows all about diseases, will that prevent him from ever getting a terminal illness? If that were possible, we'd all become doctors.
Kafka's view of the law in The Trial is that it is haphazard and reasonably unreasonable. This is because The Trial is as much about this life we live as it is specifically about one small aspect of it, the law. It is the mysterious quality of the law, and the question of what Joseph is ultimately accused of, that is at the heart of the novel.
Here is what the novel asks all of us: In our lives, injustices abound; false accusations are made against us; in the end, we will no doubt get punished even if we are completely innocent. If that's all true, as crazy as it may seem, how do we go on, how do we persevere and try to enjoy our lives and live them to the fullest, nonetheless?
How telling and prophetic it is that the whole process of the arrest and trial starts (occurs to Joesph) on his birthday.