If we're talking about the same thing, Pega is for companies with lots of money to burn, IMO. If you thought your hand-crafted Java solutions were difficult to understand and maintain, wait until the same developers start using Pega. The decision to move to Pega is most probably made by some PHB because I don't think that any sane technical person would actually want to switch to that.
Disclaimer: I've never actually used Pega for development, I only evaluated it and ran away screaming from what I saw. Also, this was over 10 years ago when I still worked for a major bank. Maybe it has gotten better since then, although I can't imagine how if it's still based on the same 4GL-ish paradigm.
I don't know Pega, and I've never heard of it before.
However, Java has been one of the most popular programming platforms for enterprise software in the past 20 years, billions of lines of code have been written for many thousands of businesses around the world; it is not going to disappear anytime soon. (Despite the "Java is dead" nonsense that you sometimes read on the Internet). Learning Java is certainly not a waste of time, if you want to get a job as an enterprise software developer.