You are here:

Focus on Java

Recent Answers

2009-11-20 Java - Max integer value:

You can use long (instead of int), which has twice as many bits and a much bigger value (big enough to hold the number of milliseconds since the beginning of the universe several times over). If that is

2009-11-19 Java - Java Fundementals Book program 5-4:

You need a class Dice. That class has a single field current, it should be private. Add a method to get the value of this field. Add another method to change this value to a random one (current = new Random()

2009-11-19 Java - Displaying Bitmaps:

Its pretty easy to implement your own zoom. You can simply: float scale = ...; Point scaleCenter = ...; protected void paintComponent(Graphics g) { Graphics2D g2 = (Grphics2D)g; AffineTransform

2009-11-18 Java - SCJP:

You have: class Vehicle2 { int passengers; // number of passengers int fuelcap; // fuel capacity in gallons int mpg; // fuel consumption in miles per gallon } You can change this

2009-11-18 Java - Java Palindrome No.:

To 'peel' off a digit from a number you can: int num = ...; int remaining = num; while(remaining != 0) { int digit = num % 10; remaining = remaining / 10; //do whatever you want with this

Categories

Browse Alphabetically

©2009 About.com, a part of The New York Times Company. All rights reserved.