Hello, as i know java source code is visible to ppl, i talk about Desktop Applets,
i'm interested to start learn Java/Web Developing, that i want to know is,
Can ppl see code of java applet in brwoser? like he can with Java Desktop Appis.

The .class file contains the compiled code, not the source. You can decompile that, but the result may or may not resemble the actual source. If the author has decided to obfuscate the code a decompile is useless.

... but if decompiled .class files are all you want, there's nothing to stop you downloading the .class (or .jar) files for the applet and decompiling them. You have access to the HTML that invokes the applet, so you know where to find the class files

The .class file contains the compiled code, not the source.

i confused little,
(NOT JAVA): Compiler takes source code and convert it to binary-machine code (*.obj), but if *.class are compiled files on java, how these are opened to public... :-s

With few words, i cant have secret parts in java
Can i create an Java applet like this? or they can see it...

if (pass == "admin")
     {
       Application.Run(new MainForm());
     }

Edited 4 Years Ago by Panathinaikos22: n/a

.class file are binary machine code for a artificial machine called the Java Virtual Machine. Software to create a JVM is part of the Java runtime that you must install before you can run a Java program.
Just like with an a .exe, you can use a decompiler program to read the machine code and produce a "best guess" of what the source program might look like. Sometimes it's quite accurate, other times it looks like garbage.
If someone really wants to keep their code secret they use a process called "obfuscation", where the code is jumbled up and names are changed in such a way that it still produces the same result when you run it, but decompilation shows a confusing mess.

the only way to ever keep your source secret (there are deobfuscators, and a human could do it as well given time) is to never distribute anything except data.
That means running your system as a SAAS application, and only exposing some web services for your customers to call.

This article has been dead for over six months. Start a new discussion instead.