• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

How to declare rect.x , rect.y , rect. width , rect.height in java and what input it accepts?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am under testing. I have to test a piece of code given to me. I had imported the necessary thing in rectangle program. I am having error that cannot resolve rect.x, rect.y, rect.width, rect.height in java. how to declare those and what datatype I have to use?
 
Saloon Keeper
Posts: 9742
80
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've given us very little to go on. You may be thinking of the java.awt.Rectangle class.
https://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html
 
Marshal
Posts: 76870
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Narayanan Krish wrote:. . . rect.x, rect.y, rect.width, rect.height in java. how to declare those

Don't declare them. You should have a Rectangle class with those fields in, with private access. You would provide methods to allow other code to gain access to those variables if appropriate.

and what datatype I have to use?

That is for you to decide.
 
Campbell Ritchie
Marshal
Posts: 76870
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:. . . the java.awt.Rectangle class. . . .

Unfortunately that class is a good example of how not to design a class.
 
Narayanan Krish
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:You've given us very little to go on. You may be thinking of the java.awt.Rectangle class.
https://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html

 
Hang a left on main. Then read this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic