1 vote
1 vote
which of the following can not be declared static ?

a)class   b)object    c)functions    d)member variables
in Object Oriented Programming
2.2k views

2 Answers

1 vote
1 vote
A. Class

In Java, only nested classes can be declared static.

3 Comments

and object ?
0
0
public static void main it is declared for class...I think object will be the answer
0
0

@Meenakshi Sharma Yes, an object can be static.
@Pavan Kumar Munnam That declaration is of main method, not class.

0
0
0 votes
0 votes

Answer: (A)

In fact, all of them can be declared static but a top-level class cannot be made static.

A good read: https://stackoverflow.com/questions/7486012/static-classes-in-java

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true