473,463 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How is this a method?

176 100+
Hello guys. I have a question. How is:
Expand|Select|Wrap|Line Numbers
  1. System.out.println("Hello, world!");
  2.  
a method? I haven't typed anything like:
Expand|Select|Wrap|Line Numbers
  1. void System.out.println() {
  2. blahblahblah
  3. }
  4.  
and I never typed:
Expand|Select|Wrap|Line Numbers
  1. System.out.println();
  2.  
So how is this a method call? Also do you think that Java C++ etc should be called Object Oriented Programming Languages(oop) or Class Oriented Programming Languages(cop). Thanks :-)
May 6 '08 #1
6 1339
Ganon11
3,652 Expert 2GB
You haven't written your own System.out.println() method, but one exists. The nice people at Sun made it for you, and so you can call it like any method you've written - by invoking its name and giving it arguments.

This particular method resides in the class System.out, and I believe out is an inner class of System.
May 6 '08 #2
Kid Programmer
176 100+
You haven't written your own System.out.println() method, but one exists. The nice people at Sun made it for you, and so you can call it like any method you've written - by invoking its name and giving it arguments.

This particular method resides in the class System.out, and I believe out is an inner class of System.
Oh I see. So it is a built in method that can be called without creating a System.out.println method. Thanks.
May 6 '08 #3
JosAH
11,448 Expert 8TB
Oh I see. So it is a built in method that can be called without creating a System.out.println method. Thanks.
No, nothing is 'built in'. The System class is a utility class with all static methods
and members, that's all. The System class can be written as follows:

Expand|Select|Wrap|Line Numbers
  1. public final class System {
  2.    private System() { } // no instance possible
  3.    ...
  4.    public static final PrintWriter out= new PrintWriter(); // coupled to stdout;
  5. }
  6.  
If you want to write something to stdout you have to make the 'out' member
print it; you can reach that object as 'System.out' and to make it print something
you can do:

Expand|Select|Wrap|Line Numbers
  1. System.out.println();
  2.  
kind regards,

Jos
May 7 '08 #4
BigDaddyLH
1,216 Expert 1GB
So how is this a method call? Also do you think that Java C++ etc should be called Object Oriented Programming Languages(oop) or Class Oriented Programming Languages(cop). Thanks :-)
You can ask on the C++ what they like to be called -- I believe it's anything but late for dinner.

The phrase "Object Oriented Programming Language" is too well established to expect it to change.
May 7 '08 #5
JosAH
11,448 Expert 8TB
You can ask on the C++ what they like to be called -- I believe it's anything but late for dinner.

The phrase "Object Oriented Programming Language" is too well established to expect it to change.
I prefer to call it "I don't want to type in all that bloody code again, better think a
bit more and have a Grolsch first"-programming.

kind regards,

Jos ;-)
May 7 '08 #6
Kid Programmer
176 100+
Thanks guys. I understand :-)
May 7 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Laurent Thery | last post by:
Given the following example: ============================================ class A { int method (B a) { return 1; } } class B extends A {
2
by: mic | last post by:
Is it possible to control method exectution using similiar mechanism as with get/setatrribute special methods for attributes? I'd like to have every (or some of ) method of class instance run...
1
by: sieg1974 | last post by:
Hi, I'm a beginner with c++ programming, and came across the following code. I have the following hierarchy of classes where both CLASS_A_PARENT and CLASS_B_PARENT extend MAIN. MAIN...
12
by: warren | last post by:
Hi, How do I call the base class's version of method when there is polymorphism? also, what if there are multiple levels of inheritance and i want to call the method that is several levels...
2
by: Sylvain Ferriol | last post by:
hello can you explain why python does not see difference between instance method and class method, having the same name example .... def f(self): .... print('instance method')...
8
by: David Veeneman | last post by:
Should a member variable be passed to a private method in the same class as a method argument, or should the method simply call the member variable? For years, I have passed member variables to...
9
by: | last post by:
Is it possible to get the name of the method that the code is currently executing in so that I can pass it to another method? For example, in void method1() I will call void method5(). In method5...
9
by: Steve Richter | last post by:
in a generic class, can I code the class so that I can call a static method of the generic class T? In the ConvertFrom method of the generic TypeConvert class I want to write, I have a call to...
27
by: idoerg | last post by:
Hi all, I am running Python 2.5 on Feisty Ubuntu. I came across some code that is substantially slower when in a method than in a function. ################# START SOURCE ############# # The...
4
by: =?Utf-8?B?QWJoaQ==?= | last post by:
I am using Reflection to invoke methods dynamically. I have got a special requirement where I need to pass a value to method by setting the custom method attribute. As I cannot change the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.