So this is entirely a programming question?
If so, the first thing to understand is how the clipboard really works.
The clipboard works by holding data and its associated format. Each program specifies what format it's sending data in, so the pasting software knows how to deal with it. The trick that makes the clipboard so flexible is that it allows programs to set multiple copies of the very same data, in different formats, at the same time.
When you copy a chunk of text from Word, what actually happens is that Word places the text multiple times, one in plain text, other in rich text format, some other proprietary format and so on. What this allows is to provide a wide range of options for programs to paste from. Notepad may pick the plain text, Word would pick the most complete format, another editor maybe would pick RTF, and so on.
Back to the original question, when you read data from the clipboard, you can query what data formats are available, then if the formated text is there, you can read it by specifying the appropriate format. It would contain, for example, the RTF simbols or the HTML markup, which is then up to you to interpret.
As an example, a few threads on StackOverflow deal with this. Two specially relevant are those:
winforms - C# How can I paste formatted text from clipboard to the RichTextBox - Stack Overflow
.net - Copying text along with its formatting from a RichTextBox - Stack Overflow
While both talk about a RichTextBox control, the clipboard part is independent of it and you can use it in any situation you need. Also, be sure to read something from Wikipedia:
Clipboard (computing - Wikipedia)
And finally, the official .NET Framework reference on the topic, applicable to C#, as well as all .NET languages:
Clipboard Class (System.Windows.Forms)
I have no real experience with Java, but the fundamental concepts are the same. Its documentation will help fill the gaps and understand the differences in the APIs.