Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

change the public with private  RSS feed

 
Mohd Arif Khan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

if i change the public with private, Is it compile?
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it compile?

Have you tried it?
What happened?

Note: When posting code, please wrap the code in code tags to preserve formatting and add highlighting.  Use the Code button above the input area.
 
Mohd Arif Khan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it show an error, get attachment.
 
Mohd Arif Khan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
error.

i am not getting that when i changed the private instead of public

Is this compile or not. why??

Screenshot-(100).png
[Thumbnail for Screenshot-(100).png]
 
Junilu Lacar
Sheriff
Posts: 11125
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's just how Java is designed - it's specified in the JLS (see section 12.1.4) - https://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is this compile or not. why?? 
  No, that does not look like a compiler error.

There are several steps involved in making a program:
design
type it into a source file
compile the source file.
execute the output of the compile step.

The error you posted looks like it is from the last step: execute  The compiler didn't have any errors if generated a class file.
The java program could not find the public static void main method.
 
Mohd Arif Khan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junilu Lacar wrote:That's just how Java is designed - it's specified in the JLS (see section 12.1.4) - https://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html



Thanks alot
 
Mohd Arif Khan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm Radder wrote:

Is this compile or not. why?? 
  No, that does not look like a compiler error.

There are several steps involved in making a program:
design
type it into a source file
compile the source file.
execute the output of the compile step.

The error you posted looks like it is from the last step: execute  The compiler didn't have any errors if generated a class file.
The java program could not find the public static void main method.




Thankyou radder
 
Ganesh Patekar
Bartender
Posts: 696
23
Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Oracle Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are a beginner then I think you better use Notepad++ to write basic programs rather than IDEs and compile and run programs using command prompt where you will have no assistance as you get in IDEs but you will learn more. Click here ---> What do these tags mean? to know how to use code tag to post code.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!