Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRanvir Sahota
9,844 PointsCompiled Lanagauge? Java Compiler?
Can Someone explain to what a compiled langage is and why java is one? And someone also explain to me about the Java Complier how it works and why we use it?
2 Answers
Seth Kroger
56,413 PointsThe processor in a computer has a very specific language, often called machine code. Ultimately the processor only deals in binary numbers, and in machine code each instruction has a number associated with it. The instructions are also fairly primitive, such as store a value at this memory location or branch to this address in the program instead of declare a variable or if() {...} else {...}
. It's not a particularly readable language, which is why there are higher level languages, like Java and all the rest, to make if easier to program. But, because it's the only language the processor understands all other languages need to be transformed into machine code to run.
Languages are classified by which way they do this, compiled or interpreted. Compiled languages are converted into machine code (or a close intermediate called byte code) by a program called a compiler. The eventual output of a compiler can be run directly by the machine (or virtual machine with byte code). Interpreted languages run through an interpreter. Much like a foreign language interpreter, a program language interpreter takes each statement in turn and tells the processor what steps to take as the program proceeds. Programs in interpreted languages are run through the interpreter every time they are run, while compiled languages need to be compiled if you make a change.
Joseph Wasden
20,407 Points"A compiler is a computer program (or a set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language), with the latter often having a binary form known as object code.[1] The most common reason for converting source code is to create an executable program."
https://en.wikipedia.org/wiki/Compiler
Here is another quick primer on StackOverflow. http://stackoverflow.com/questions/17253545/scripting-language-vs-programming-language
Ranvir Sahota
9,844 PointsRanvir Sahota
9,844 PointsThankyou for detailed response but I this still leaves me questions. Just to ensure I have an understanding the interpreter in interpreted langauges processes a statement into machine to pass to the processeor one at a time where as in complied langauges it processes all source code into machine code to pass to the processor at runtime? If so what are the benefits of this? What other diffrences aare there between complied and Interpreted langauges? Why were they created? When talking about complied languages you mentioned how some compilers convert the source code into byte code. Why is it only some or did I missunderstand and it applies to all? Why do compliers convert source code into byte code instead of machine code like interpretated langauges? Sorry for asking so many questions I just really wanna understand this. Thanks!