A PHP Error was encountered

Severity: Warning

Message: fopen(/tmp/ci_session9gpom7jln6r2h4lrd5as48ueqs3lb4kl): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 176

Backtrace:

File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct

File: /var/www/html/index.php
Line: 311
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Failed to read session data: user (path: /tmp)

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct

File: /var/www/html/index.php
Line: 311
Function: require_once

Creating an object in Java. | Sweta321
Coders Packet

Creating an object in Java.

By Sweta Sinha

An object is created from a class. In Java, the new keyword is used to create new objects. A class acts as a blueprint for the objects.

CREATING AN OBJECT IN JAVA

This project is about creating objects in Java. In Java, no program will execute without creating an object. Using a new keyword is the most popular method of creating an object in Java. In Java everything is related to classes and objects.Creating an object in Java is important as it calls variables and methods of a class.

importjava.io.*;
public class Aniaml
{
  public Animal(String name)
  //This constructor has one parameter,name//
  System.out.println("Passd Name is:"+name);
}
public static void main(String[] args)
//Following statement would create an object myAnimal
{
  Animal myAnimal= new Animal("Scooby");
}

Output:
Passed Name is:Scooby

 

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by Sweta Sinha (Sweta321)

Download packets of source code on Coders Packet