How to write code for extension (Format)

I installed all the necessary tools to develop extension
I already created an extension successfully by referring this page

but when i am pasting some java codes from internet and creating extension, I am getting error
so I want to know that what is the code format to make extensions for app inventor platforms
Thank you…