• Post Reply Bookmark Topic Watch Topic
  • New Topic
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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

range of weightx variable

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic