i have other questions about this code from oracle as well(like why they used an AbstractDocument in the first place? and why the if statement?), but this question is about the caste(you can answer the others if you like ).
doc = (AbstractDocument)styledDoc;
doc = styledDoc;
do the same thing?
am i missing something?
ps. it is from the tutorial on using text components. the file is TextComponentDemo.java.