mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-24 10:01:38 +00:00
Merge remote-tracking branch 'adambard/master'
Conflicts: java.html.markdown
This commit is contained in:
commit
bc21259249
@ -1,5 +1,8 @@
|
|||||||
---
|
---
|
||||||
language: PHP
|
language: PHP
|
||||||
|
contributors:
|
||||||
|
- ["Malcolm Fell", "http://emarref.net/"]
|
||||||
|
- ["Trismegiste", "https://github.com/Trismegiste"]
|
||||||
translators:
|
translators:
|
||||||
- ["Pascal Boutin", "http://pboutin.net/"]
|
- ["Pascal Boutin", "http://pboutin.net/"]
|
||||||
lang: fr-fr
|
lang: fr-fr
|
||||||
|
@ -513,7 +513,12 @@ public class ExampleClass extends ExampleClassParent implements InterfaceOne,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// Abstract Classes
|
// Abstract Classes
|
||||||
|
=======
|
||||||
|
|
||||||
|
// Abstract Classes
|
||||||
|
>>>>>>> adambard/master
|
||||||
// Abstract Class declaration syntax
|
// Abstract Class declaration syntax
|
||||||
// <access-level> abstract <abstract-class-name> extends <super-abstract-classes> {
|
// <access-level> abstract <abstract-class-name> extends <super-abstract-classes> {
|
||||||
// // Constants and variables
|
// // Constants and variables
|
||||||
@ -530,6 +535,7 @@ public class ExampleClass extends ExampleClassParent implements InterfaceOne,
|
|||||||
|
|
||||||
public abstract class Animal
|
public abstract class Animal
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
public abstract void makeSound();
|
public abstract void makeSound();
|
||||||
|
|
||||||
// Method can have a body
|
// Method can have a body
|
||||||
@ -555,10 +561,38 @@ public abstract class Animal
|
|||||||
{
|
{
|
||||||
System.out.println("I am abstract");
|
System.out.println("I am abstract");
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
public abstract void makeSound();
|
||||||
|
|
||||||
|
// Method can have a body
|
||||||
|
public void eat()
|
||||||
|
{
|
||||||
|
System.out.println("I am an animal and I am Eating.");
|
||||||
|
// Note: We can access private variable here.
|
||||||
|
age = 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No need to initialize, however in an interface
|
||||||
|
// a variable is implicitly final and hence has
|
||||||
|
// to be initialized.
|
||||||
|
private int age;
|
||||||
|
|
||||||
|
public void printAge()
|
||||||
|
{
|
||||||
|
System.out.println(age);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abstract classes can have main function.
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
System.out.println("I am abstract");
|
||||||
|
}
|
||||||
|
>>>>>>> adambard/master
|
||||||
}
|
}
|
||||||
|
|
||||||
class Dog extends Animal
|
class Dog extends Animal
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
// Note still have to override the abstract methods in the
|
// Note still have to override the abstract methods in the
|
||||||
// abstract class.
|
// abstract class.
|
||||||
@Override
|
@Override
|
||||||
@ -580,6 +614,29 @@ class Dog extends Animal
|
|||||||
pluto.eat();
|
pluto.eat();
|
||||||
pluto.printAge();
|
pluto.printAge();
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
// Note still have to override the abstract methods in the
|
||||||
|
// abstract class.
|
||||||
|
@Override
|
||||||
|
public void makeSound()
|
||||||
|
{
|
||||||
|
System.out.println("Bark");
|
||||||
|
// age = 30; ==> ERROR! age is private to Animal
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: You will get an error if you used the
|
||||||
|
// @Override annotation here, since java doesn't allow
|
||||||
|
// overriding of static methods.
|
||||||
|
// What is happening here is called METHOD HIDING.
|
||||||
|
// Check out this awesome SO post: http://stackoverflow.com/questions/16313649/
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
Dog pluto = new Dog();
|
||||||
|
pluto.makeSound();
|
||||||
|
pluto.eat();
|
||||||
|
pluto.printAge();
|
||||||
|
}
|
||||||
|
>>>>>>> adambard/master
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final Classes
|
// Final Classes
|
||||||
|
@ -64,7 +64,7 @@ doStuff()
|
|||||||
// There are three special not-a-real-number values:
|
// There are three special not-a-real-number values:
|
||||||
Infinity; // result of e.g. 1/0
|
Infinity; // result of e.g. 1/0
|
||||||
-Infinity; // result of e.g. -1/0
|
-Infinity; // result of e.g. -1/0
|
||||||
NaN; // result of e.g. 0/0
|
NaN; // result of e.g. 0/0, stands for 'Not a Number'
|
||||||
|
|
||||||
// There's also a boolean type.
|
// There's also a boolean type.
|
||||||
true;
|
true;
|
||||||
|
@ -5,6 +5,7 @@ contributors:
|
|||||||
- ["Eugene Yagrushkin", "www.about.me/yagrushkin"]
|
- ["Eugene Yagrushkin", "www.about.me/yagrushkin"]
|
||||||
- ["Yannick Loriot", "https://github.com/YannickL"]
|
- ["Yannick Loriot", "https://github.com/YannickL"]
|
||||||
- ["Levi Bostian", "https://github.com/levibostian"]
|
- ["Levi Bostian", "https://github.com/levibostian"]
|
||||||
|
- ["Clayton Walker", "https://github.com/cwalk"]
|
||||||
filename: LearnObjectiveC.m
|
filename: LearnObjectiveC.m
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -747,4 +748,8 @@ __unsafe_unretained NSArray *unsafeArray; // Like __weak, but unsafeArray not se
|
|||||||
|
|
||||||
[Programming with Objective-C. Apple PDF book](https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/ProgrammingWithObjectiveC.pdf)
|
[Programming with Objective-C. Apple PDF book](https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/ProgrammingWithObjectiveC.pdf)
|
||||||
|
|
||||||
|
[Programming with Objective-C for iOS](https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/ObjectiveC.html)
|
||||||
|
|
||||||
|
[Programming with Objective-C for Mac OSX](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html)
|
||||||
|
|
||||||
[iOS For High School Students: Getting Started](http://www.raywenderlich.com/5600/ios-for-high-school-students-getting-started)
|
[iOS For High School Students: Getting Started](http://www.raywenderlich.com/5600/ios-for-high-school-students-getting-started)
|
||||||
|
@ -12,7 +12,7 @@ Swift is a programming language for iOS and OS X development created by Apple. D
|
|||||||
|
|
||||||
The official [Swift Programming Language](https://itunes.apple.com/us/book/swift-programming-language/id881256329) book from Apple is now available via iBooks.
|
The official [Swift Programming Language](https://itunes.apple.com/us/book/swift-programming-language/id881256329) book from Apple is now available via iBooks.
|
||||||
|
|
||||||
See also Apple's [getting started guide](https://developer.apple.com/library/prerelease/ios/referencelibrary/GettingStarted/RoadMapiOS/index.html), which has a complete tutorial on Swift.
|
See also Apple's [getting started guide](https://developer.apple.com/library/prerelease/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/), which has a complete tutorial on Swift.
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
// import a module
|
// import a module
|
||||||
|
Loading…
Reference in New Issue
Block a user