programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Tim Cooke
• Campbell Ritchie
• Paul Clapham
• Ron McLeod
• Liutauras Vilda
Sheriffs:
• Jeanne Boyarsky
• Rob Spoor
• Bear Bibeault
Saloon Keepers:
• Jesse Silverman
• Tim Moores
• Stephan van Hulst
• Tim Holloway
• Carey Brown
Bartenders:
• Piet Souris
• Al Hobbs
• salvin francis

# range of weightx variable

Ranch Hand
Posts: 45
• Number of slices to send:
Optional 'thank-you' note:
Which is true about range of weightx variable
A. the same as integer values
B. the same as double values
C. from 0.0 to Double.MAX_VALUE
D. from 0.0 to 1.0

Ranch Hand
Posts: 98
• Number of slices to send:
Optional 'thank-you' note:
Hi
The answer is D.From the API:
Specifies how to distribute extra horizontal space.
The grid bag layout manager calculates the weight of a column to be the maximum weighty of all the components in a row. If the resulting layout is smaller horizontally than the area it needs to fill, the extra space is distributed to each column in proportion to its weight. A column that has a weight zero receives no extra space.
If all the weights are zero, all the extra space appears between the grids of the cell and the left and right edges.
The default value of this field is 0. weightx should be a non-negative value.
Surya

antraarora
Ranch Hand
Posts: 45
• Number of slices to send:
Optional 'thank-you' note:
i agree. but isn't double.MAX_VALUE same as 1.0. Then why isn't C a valid answer?

Surya B
Ranch Hand
Posts: 98
• Number of slices to send:
Optional 'thank-you' note:
The value of Double.Max_value is 1.7976931348623157E308..its not same as 1.0,try this out this will return false
public static void main(String[] args)
{
System.out.println(Double.MAX_VALUE);
System.out.println(1==Double.MAX_VALUE);
}

Ranch Hand
Posts: 18944
• Number of slices to send:
Optional 'thank-you' note:

Originally posted by antraarora:
i agree. but isn't double.MAX_VALUE same as 1.0. Then why isn't C a valid answer?

from the jdk1.2.2
The default value of this field is 0. weightx should be a non-negative value.
so why it is Double.MAX_VALUE?