• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

package

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please confirm
Q1
What can you add at //....../?
//....../?
public class Test {
}
A.package myprog;-true
B.import java.AWT.*;-true
C.protected class Prot {}-false
D.class Another {}-true
E.public static int myData = 123;-false
Order of package, import, class
Question 2: can class put before public class in a file?
Class A {}
Public class B{}
true-the order for class does not matter
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Q1
What can you add at //....../?
//....../?
public class Test {
}
A. package myprog;-true
B. import java.AWT.*;-true
C. protected class Prot {}-false
D. class Another {}-true
E. public static int myData = 123;-false

A. package myprog;-true
B. import java.AWT.*;-false,it should be import java.awt.*;
c. protected class Prot {}-false
D. class Another {}-true
E. public static int myData = 123;-false
Class A {}
Public class B{}
This is OK as long as there is only one public class in the file
Surya
 
reply
    Bookmark Topic Watch Topic
  • New Topic