Discussion board
topic
As we all know java is an Object Oriented Programming language , but it is not fully support OOP ,Why java is not fully Objective Oriented ?
Which language is pure OOP?
In java can we have methods with call by reference of parameters ?
package family;

public class Mother
{
public static void display()
{
System.out.println("My mother's name is Kanaka Lata Biswal");
}
}

import MyClass.family.*;

public class MyFamily{

public static void main(String args[])
{
Mother.display();
}
}


MyFamily.java:7: cannot access MyClass.family.Mother
bad class file: .\MyClass\family\Mother.class
class file contains wrong class: family.Mother
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
Mother.display();
^
1 error

please help me in importing the package in the right way.
import Car_package.*;

public class CarImportPackage {

public static void main (String[] args)

{
Car.display (777, "Ferrari");
}
}

In the above class they hav called display method frm the Car_package by using the class "Car"(which is implemented in Car_package), can anybody plz explain me tht, Why Object is not created in the main method to call "display" method? how can they use the class "Car" to call display method Instead of using Object?......plz clear my doubt.. thanking u in advance...
What is meant by implementing separate interface? In a program they have asked to implement separate interface to print something....What does this mean?
class branch
{
public static void main(String[] args)
{
int[] a={12,34,35,42,9,76,31,54,99,150};
int i;
boolean gotit=false;
for(i=0;i<a.length;i )
{
for(int j=2;j<a[i];j ){
if(a[i]%j!=0)
{
gotit=true;
break;
}
}

}
if(gotit)
{
System.out.println("found the prime no is" a[i] "at index" i);
}
else
{
System.out.println("no number is prime in given array");
}
}
}
i am getting runtime error as arrayindexoutofbound
i am unable to set the path to complie the sample program
public class one
{
enum Day
{
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
};

public static void main(String[] args) {
Day yesterday = Day.Thursday;
Day today = Day.Friday;
Day tomorrow = Day.Saturday;

System.out.println("Today is " today);
System.out.println("Tomorrow will be " tomorrow);
System.out.println("Yesterday was " yesterday);
}
}
it throws the foolowing error!
D:\java pgs>javac one.java
one.java:3: ';' expected.
enum Day
^
1 error
and if i use enum data type outside the class then like..
enum Day
{
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
}
public class one{
public static void main(String[] args) {
Day yesterday = Day.Thursday;
Day today = Day.Friday;
Day tomorrow = Day.Saturday;

System.out.println("Today is " today);
System.out.println("Tomorrow will be " tomorrow);
System.out.println("Yesterday was " yesterday);
}
}
it throws many errors!!
D:\java pgs>javac one.java
one.java:1: Class or interface declaration expected.
enum Day
^
one.java:7: Class Day not found.
Day yesterday = Day.Thursday;
^
one.java:7: Class Day not found.
Day yesterday = Day.Thursday;
^
one.java:7: Undefined variable or class name: Day
Day yesterday = Day.Thursday;
^
one.java:8: Class Day not found.
Day today = Day.Friday;
^
one.java:8: Class Day not found.
Day today = Day.Friday;
^
one.java:8: Undefined variable or class name: Day
Day today = Day.Friday;
^
one.java:9: Class Day not found.
Day tomorrow = Day.Saturday;
^
one.java:9: Class Day not found.
Day tomorrow = Day.Saturday;
^
one.java:9: Undefined variable or class name: Day
Day tomorrow = Day.Saturday;
^
10 errors
please help me debugging this..
class MyDetails
{
public static void main(String[] args)
{
//Creating an instance of Details class
Details info1=new Details();
Details info2=new Details();

//Name and age passed to methods of first person
info1.setName("Padmini");
info1.setAge(20);
info1.print();

//Name and age passed to methods of second person
info2.setName("Manjunath");
info2.setAge(25);
info2.print();
}
}
Here above, cant we use the same instance info1 instead of info2 for calling method setAge and print to display second person details? I checked it,works fine, but does it make any differrence.
the requirement for the user to provide inputs stems from the module problem of inheritance.the problem is:
i have to display what the user inputs(thats it)....i need the syntax to do so.....thnks in advance
 1  2 next >>