html - Java Applet Commented Applet Tag -


i new applets , came across unusual. in 1 of programs went through, applet html tag mentioned comment in applet java file (.java) comment seems getting executed. how possible?

code:

    import java.awt.*;      import java.applet.*;  /*<applet code="myapplet" width=100 height=50></applet> */      //why give comment here , how executed ??        class myapplet extends  applet      {     public void paint(graphics g)     {     g.drawstring("a simple applet",100,100);       }   } 

comment: /*<applet code="myapplet" width=100 height=50></applet> */ 

how above comment getting executed? aren't comments meant skipped?

why method not mentioned on oracle or other websites? oracle asks create seperate html file. method use 3rd party library execute comment?

i getting error when don't make class public , when keep file , class name different.

can please explain method? googled lot explanation method of including tags in comment found. there post on answer not point. please help.

how accidentally figure out possible? particular feature of applet class?

but how override usual mechanism of skipping comment lines?

you're thinking compiler, not applet viewer. different tools work in different ways.

does parse comments too?

afaiu applet viewer parses java source code (note, source code, not binary) class definition. design ignores code not in comment , inspects commented code possible applet tags. new functionality introduced around java 1.7 or 1.6 afair.

i didn't point -'by design ignores code not in comment'. mean looks comments , further selects comments applet tag?

sorry, repeat me, unclear. "does mean looks comments , further selects comments applet tag?" yep. , thanks, that's better way express meant.

i'll close adding comments @zakki think informative hidden in comments section:

@zakki: think appletviewer myapplet.java parses myapplet.java html, , ignores unsupported elements import java.awt.*;. appletviewer tags

@zakki: seems appletviewer process input token stream ant doesn't care java/html syntax. gist.github.com/zakki/b5176a7d37fa3938f0646d11d9bd01a5


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -