Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1088361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:03:41+00:00 2026-05-16T23:03:41+00:00

Is it possible to create a constructor with arguments on a JavaFX class? This

  • 0

Is it possible to create a constructor with arguments on a JavaFX class?

This can be achieved in Java by:

   MyObj(String foo, String bar) {
       // ... 
   }

Is this possible in JavaFX?

i.e.

   // creating an Object Literal without the specified arguments must result in compile error
   var myObj = MyObj {} ;

   // While this should not result in compile error
   var myObj2 = MyObj {foo: "foo", bar: "bar"};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:03:41+00:00Added an answer on May 16, 2026 at 11:03 pm

    The short answer is “no” – it is perfectly legal to create an instance of a class with no properties set on it – you can’t force a compilation error.

    I don’t know your use case, but you could use a postinit block to set various defaults after object creation if that is suitable, or use a regular Java object – you can of course instantiate Java objects from JavaFX, and they are subject to compilation checks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Create Excel file in Java How to save output in excel format
Possible Duplicate: Create shortcut to console.log() In javascript we can easy assign functions to
Is this possible? For example if i write Car myCar; Then the constructor taking
Is it possible to use named arguments in a Scala constructor, and later on
It is not possible to create an object by directly calling the constructor of
Is it possible to create a connection in a PHP class file and use
Possible Duplicate: Is there a call_user_func() equivalent to create a new class instance? I
My goal is to create a trait that a case class can extend, which
Possible Duplicate: Can I pass an array as arguments to a method with variable
I have an object defined like this: create or replace type MYOBJ as object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.