Is there any standard coding syntax in java?
I was using System.acm.println
while one of the stanford videos imports acm.program and use println for the same output.
Is there any standard coding syntax in java?
I was using System.acm.println
while one of the stanford videos imports acm.program and use println for the same output.
Yes Java is a statically typed language and has a very specific syntax. Importing a package allows you to reference methods and classes within it without having to call it by it's full path. For example, if you write import java.lang.Math;
then when you want to call the method pow
you can write Math.pow(param1, param2);
instead of java.lang.Math.pow(param1, param2;
. So, Stanford's class is importing the class acm.program
to make it simpler and faster to code. This is standard coding practice. To get the acm library available in your project take a look at this: How to import a jar in Eclipse