Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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?
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic