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 8910131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:36:38+00:00 2026-06-15T03:36:38+00:00

I was just goofing around with java when i thought of trying to get

  • 0

I was just goofing around with java when i thought of trying to get my work done not from a method but from a class. Check out what I did.

import javax.swing.*;

class foolingAround{
    public static void main(String ARG[]) {
        createMyInterface();
    }

    private static void createMyInterface(){
        JFrame f = new JFrame("Frame from Swing but not from other class");
        f.setSize(100,100);
        f.setVisible(true);
        new createAnotherInterface();
    }

}

class createAnotherInterface{
    public static void main(String arg[]){
        giveMe();
    }

    static JFrame giveMe(){
        JFrame p = new JFrame("Frame from Swing and from another class");
        p.setSize(100,100);
        p.setVisible(true);
        return p;
    }
}

It compiled without showing any error but the frame from class createAnotherInterface did not show up. Why? When do i make different classes and not methods?

  • 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-06-15T03:36:39+00:00Added an answer on June 15, 2026 at 3:36 am

    You were just creating a new Object for createAnotherInterface class and by default it calls its default constructor and in that default constructor there is no call to giveMe() method.

    I am not sure if i am right or wrong but i ask you to create a constructor in “createAnotherInterface” class and call the “giveMe()” method in the constuctor. i hope that will solve your problem.

    or atleast call

    new createAnotherInterface().giveMe();
    

    in your createMyInterface() class

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

Sidebar

Related Questions

just wanted to ask where I define initial class properties? From other languages I
Just a simple question, but can't get an answer on my own. In memory
Just curious (maybe this is an implementation detail so you may not know) but
Complete noob to C , just getting started with some goofing around, wondering how
Just trying out scrapy and trying to get a basic spider working. I know
There is a similar question going around, but it just got the same old
Just playing around RoR, trying to find a way through some modelling. Please, mind
Just a quick question .. I have jaxrs GET method without any @consume annotation
Just checking my JS and I have an error, but I cannot see where.
Just playing around with Wordpress / Contact Form 7 . Is it possible to

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.