Search   Feed   Browse   Add
Feed items 11 - 20 of 26 for June 2008

Java programming FAQ

Answers to frequently asked questions about Java programming.

How can I call static class members from a different class - (Found June 24, 2008 )

A: Calling static members in a separate class is very similar to calling a static method in a separate class. Most importantly, the static member must have a public, package or protected modifier that makes it accessible to the calling class. Use the class name, a dot separator and the name of the member variable, as with the AWT Color class properties below:
http://www.codestyle.org/java/FAQ.shtml#callstaticvariable

Help request - (Found June 24, 2008 )

Use the form below to submit a help request or general enquiry about the Code Style Web site. Read our guidelines on asking the right questions first.
http://www.codestyle.org/java/FAQ.shtml#help

How can I download a Web page and write it to a file - (Found June 24, 2008 )

A: The standard Java inputoutput and network APIs make it quite easy to acquire content from the Internet and write files. Writing from a stream input to a file output is the slightly complex part. The example below uses a copy(InputStream, OutputStream) method adapted from a version in Java IO by Elliotte Rusty Harold.
http://www.codestyle.org/java/FAQ.shtml#downloadfile

How can I design my own fonts using Java - (Found June 24, 2008 )

A: It is puzzling that you would want to design fonts using Java, the language is not particularly suited for this purpose. There are several very good applications for designing and converting fonts such as Fontographer for example.
http://www.codestyle.org/java/FAQ.shtml#javafontdesign

How do I add two numbers in Java - (Found June 24, 2008 )

A: To add two numbers in Java, use the simple mathematical plus operator, which may be applied to any numeric variable type, as below:
http://www.codestyle.org/java/FAQ.shtml#javaaddnumbers

How can I add two numbers using a method - (Found June 24, 2008 )

A: For simple mathematical functions a method would usually declare the input variables as method arguments and a return type that matches the required numeric type for the result. In the simplest case an add(int, int) method would return an int value, as below:
http://www.codestyle.org/java/FAQ.shtml#addnumbersmethod

How should I round a double up to an int - (Found June 24, 2008 )

A: To round a double value up and convert it to an int value takes two operations. The static Math.ceil(double) method returns a double value that is equal to the "next highest" integer. You must then give an explicit down cast to an int, as below.
http://www.codestyle.org/java/FAQ.shtml#roundupdoubleint

How do I get the name of the operating system - (Found June 24, 2008 )

A: To get the operating system name in Java use the static System.getProperty("os.name") method, which returns a string. Other operating system property keys are "os.arch" for the hardware architecture and "os.version" for the version number.
http://www.codestyle.org/java/FAQ.shtml#osproperties

What is a recursive method - (Found June 24, 2008 )

A: A recursive method is one whose method body includes a call to itself, so that it is called repeatedly until an expected condition is met or it cannot continue the recursion any longer. These methods often take an object or numeric argument that is subject to progressive interrogation or mathematical processing at each pass. Recursive methods must be designed carefully to ensure that they do not result in a very deep or endless recursion, which is likely to cause an OutOfMemoryError.
http://www.codestyle.org/java/FAQ.shtml#recursivemethod

What is a good beginner's book about Java - (Found June 24, 2008 )

A: Thinking In Java by Bruce Eckel is a good beginner's book on Java, which is available as a free download too.
http://www.codestyle.org/java/FAQ.shtml#beginnerbook
Available Archives
- June (26 items)
Sponsored Links
© 2008 FeedCapsule.com  |  Contact