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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:45:26+00:00 2026-05-31T01:45:26+00:00

So in my class declared as public class pcb , I have the following

  • 0

So in my class declared as “public class pcb“, I have the following constructor: public pcb(int p, int a, int b).

In public static void main(String[] args) I try to call the constructor in a for loop where I add a “pcb” into a different position in an array. Here is the for loop where the last line is where I get the error:

for(int i=0; i<numJob; i++){
   pI = scan.nextInt();
   arr = scan.nextInt();
   bst = scan.nextInt();
   notHere[i]=new pcb(pI, arr, bst);
}

What am I doing wrong? Is it syntax or is it the structure of my program. I haven’t used Java that much and I think that’s my main problem.

  • 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-31T01:45:27+00:00Added an answer on May 31, 2026 at 1:45 am

    You haven’t given all of the relevant code, but the error indicates that pcb is an inner class of fbMain:

    public class fbMain {
        //...
        public class pcb {
        }
        //...
    }
    

    You can fix this error by making pcb static:

     public static class pcb {
     }
    

    Or by moving the class to its own file. Or, if pcb cannot be static (because it is associated with an instance of fbMain), you can create a new pcb by passing an instance of fbMain:

    notHere[i] = instanceOfFbMain.new pcb(pI, arr, bst);
    

    It is likely the first that you want. Please also note that by convention, Java type names start with an upper-case letter.

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

Sidebar

Related Questions

I declared the following class class A { //not public public static void main(String
WorkAround: I have declared a class level Public static variable and initialized with a
I have a class, Plotter , which has a static event (declared public static
If I have a class declared as: public class MyPersistentClass { public int ID
I have the following class declared: public partial class MainWindow : Window And I
I have a class declared as: public class Foo<T> : Panel where T :
I've got the following Generic usercontrol declared: public partial class MessageBase<T> : UserControl {
I have declared a class as class DCFrameListener : public FrameListener, public OIS::MouseListener, public
I currently have a page which is declared as follows: public partial class MyPage
If I have a java class which is package-private (declared with class, not public

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.