Below are important Question & Answers taken from the Q&A discussions in this section.
Q1. Can you please specify what are programming languages which are compiled to another programming languages? (Related to lecture on Compilation)
ClojureScript (https://clojurescript.org) is one such language (a slight variant of Clojure) and it comes with a compiler that compiles its programs into Java Script. It looks like there are not many tools that do such translations. Such compilers are also referred to as source-to-source compilers or transcompilers.
Also FYI, Clojure is also a language, whose programs once compiled run on JVM ~ the platform on which Java programs run and is covered in detail in this course.
Web containers like Tomcat also convert JSPs code into Servlet source code before compiling them into class file. Since we are learning about Java in this course, you may not be aware of JSPs & Servlets, which fall under Java EE. But, just keep in mind that there is source code to source code translation happening (from JSP to Servlet). But, Web container like Tomcat is not a compiler. It is more of a Web server, but can do some code translation + compiling translated code.
P.S. We discuss JSPs & Servlets briefly towards the end of the course in a separate section.
Q2. Why are we using public for only one class?
It is how it has been designed and I am not sure if the reason is documented. But here is a good reason on why it is done that way. Let's assume we have two public classes Y & Z in a file named Y.java. Now, let's assume a different class X is using Z. Now, when we compile X, the compiler first tries to locate Z.class and if it cannot find it, then it tries to locate Z.java so that it can compile it automatically. But, since we only have Y.java, the class Z cannot be located and hence we get a compilation error. So, we do need to place them in separate files.