Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

private static method signature  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I was writing a method which can be used in a method--"public static void ..." and i wrote my method as "private static void ...".
Just wondering what's the difference between the method signature "private static void ..." and "static private void ..."?

Thanks in advance

Charles
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nothing.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may be wrong here but if you write a method with public static void and then one with private static void they do seem different to me. Your public static method would be able to be called statically from within another object where as a private static method would only be able to be called from with the same object of which is has been declared.
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Sloan Bowman:
I may be wrong here but if you write a method with public static void and then one with private static void they do seem different to me.



Yes. But if you look closely you will see that this wasn't the question...
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To elaborate, the class and member modifier keywords (public, private, protected, synchronized, static, final, volatile, transient and awesome) can be specified in any order, though conventions certainly have taken shape over the years.
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by David Harkness:
public, private, protected, synchronized, static, final, volatile, transient and awesome



Awesome?
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Ernest Friedman-Hill:
Awesome?


Oh shoot, I'm injecting my personal attributes into the discussion again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!