Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: expected unqualified id before public error

  1. #1
    Junior Member
    Join Date
    Oct 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation expected unqualified id before public error

    expected unqualified id before public error my code is below
    #include<iostream>
    using namespace std;
    public Class hello{
    private: int n;
    public : Hello() // creating a constructor
    {
    cout<<"object created"<<endl;
    }
    };
    int main(){

    hello x, y, z; // creating 3 objects
    return 0;
    }
    code in dev++

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: expected unqualified id before public error

    The posted code looks like C++ not java. This is a java forum.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 2
    Last Post: March 23rd, 2014, 08:44 AM
  2. public expect statement error
    By nepperso in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 23rd, 2013, 09:30 PM
  3. public void run () error message
    By Niquinho in forum What's Wrong With My Code?
    Replies: 12
    Last Post: December 23rd, 2012, 02:22 AM
  4. Public class help/error
    By Plural in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 11th, 2010, 05:22 PM