mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 21:52:31 +03:00
Compare commits
15 Commits
3bed0f7045
...
61c1da86f8
Author | SHA1 | Date | |
---|---|---|---|
|
61c1da86f8 | ||
|
bc3598b1cd | ||
|
31c61ca2e0 | ||
|
584edfc133 | ||
|
bbcdf7e44a | ||
|
8791bcc351 | ||
|
c5b9c4d65f | ||
|
b76bafca9a | ||
|
541a471cfc | ||
|
e9112f32fe | ||
|
d25f9dc2a4 | ||
|
ab19104c33 | ||
|
a53a2e2c74 | ||
|
cb6985a20b | ||
|
83d115ac3b |
@ -460,38 +460,30 @@ public class BeispielKlasse extends ParentBeispielKlasse implements InterfaceEin
|
||||
Die folgenden Links dienen lediglich dazu Verständnis für die Kapitel aufzubauen.
|
||||
Für tiefergreifende Fragen ist Google der beste Startpunkt.
|
||||
|
||||
**Offizielle Oracle Guides**:
|
||||
### Offizielle Oracle Guides:
|
||||
|
||||
* [Java Tutorial Trail from Sun / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Java Access level modifiers](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [Object-Oriented Programming Concepts](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Inheritance](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Polymorphism](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Abstraction](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Exceptions](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Interfaces](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Java Code Conventions](https://www.oracle.com/technetwork/java/codeconventions-150003.pdf)
|
||||
* Neue Features in Java 8:
|
||||
* [Lambda expressions (functional programming)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [Date and time API (java.time package)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
**Online Tutorials**
|
||||
### Online Tutorials:
|
||||
|
||||
* [Learneroo.com - Learn Java](http://www.learneroo.com)
|
||||
|
||||
* [Codingbat.com](http://codingbat.com/java)
|
||||
|
||||
### Bücher:
|
||||
|
||||
**Bücher**:
|
||||
|
||||
* [Head First Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
|
||||
* [Head First Java](https://www.oreilly.com/library/view/head-first-java/9781492091646/)
|
||||
* [Thinking in Java](https://www.amazon.com/Thinking-Java-4th-Bruce-Eckel/dp/0131872486/)
|
||||
|
||||
* [Objects First with Java](http://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/0132492660)
|
||||
|
||||
* [Java The Complete Reference](http://www.amazon.com/gp/product/0071606300)
|
||||
* [Objects First with Java](https://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/1292159049/)
|
||||
* [Java The Complete Reference](https://www.amazon.com/Java-Complete-Reference-Thirteenth-dp-1265058431/dp/1265058431)
|
||||
|
@ -820,38 +820,30 @@ public class EnumTest {
|
||||
Οι σύνδεσμοι που παρέχονται εδώ είναι απλά για να κατανοήσεις περισσότερο το θέμα.
|
||||
Σε προτρύνουμε να ψάξεις στο Google και να βρεις συγκεκριμένα παραδείγματα.
|
||||
|
||||
**Eπίσημοι Οδηγοί της Oracle**:
|
||||
### Eπίσημοι Οδηγοί της Oracle:
|
||||
|
||||
* [Φροντιστήριο εκμάθησης Java από τη Sun / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Τροποποιητές επιπέδου πρόσβασης(Access level modifiers) Java](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [Έννοιες αντικειμενοστραφούς (Object-Oriented) προγραμματισμού](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Κληρονομικότητα (Inheritance)](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Πολυμορφισμός (Polymorphism)](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Αφαιρετικότητα (Abstraction)](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Εξαιρέσεις (Exceptions)](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Διεπαφές (Interfaces)](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Συμβάσεις κώδικα Java (Code Conventions)](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
|
||||
* Νέες δυνατότητες στην Java 8:
|
||||
* [Lambda expressions (functional programming)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [Date and time API (java.time package)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
**Πρακτικές και Φροντιστήρια Online**
|
||||
### Πρακτικές και Φροντιστήρια Online:
|
||||
|
||||
* [Learneroo.com - Μάθε Java](http://www.learneroo.com)
|
||||
|
||||
* [Codingbat.com](http://codingbat.com/java)
|
||||
|
||||
|
||||
**Βιβλία**:
|
||||
### Βιβλία:
|
||||
|
||||
* [Head First Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
|
||||
* [Thinking in Java](https://www.amazon.com/Thinking-Java-4th-Bruce-Eckel/dp/0131872486/)
|
||||
|
||||
* [Objects First with Java](http://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/0132492660)
|
||||
|
||||
* [Java The Complete Reference](http://www.amazon.com/gp/product/0071606300)
|
||||
|
@ -402,21 +402,18 @@ class PennyFarthing extends Bicicleta {
|
||||
Estos links son sólo para tener un entendimiento del tema, no dudes en
|
||||
usar Google y encontrar ejemplos más específicos
|
||||
|
||||
Otros temas a investigar:
|
||||
### Guías oficiales de Oracle:
|
||||
|
||||
* [Java Tutorial Trail from Sun / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Java Access level modifiers](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [Object-Oriented Programming Concepts](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Inheritance](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Polymorphism](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Abstraction](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Exceptions](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Interfaces](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconv-138413.html)
|
||||
* Nuevas características en Java 8:
|
||||
* [Lambda expressions (functional programming)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [Date and time API (java.time package)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
@ -898,41 +898,30 @@ public class EnumTest {
|
||||
Les liens ci-dessous sont données si vous souhaitez approfondir sur le sujet,
|
||||
n'hésitez pas à consulter Google pour trouver des exemples spécifiques.
|
||||
|
||||
**Guides officiels d'Oracle** :
|
||||
### Guides officiels d'Oracle:
|
||||
|
||||
* [Java Tutorial Trail from Sun / Oracle](https://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Java Access level modifiers](https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [Object-Oriented Programming Concepts](https://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Inheritance](https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Polymorphism](https://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Abstraction](https://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Exceptions](https://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Interfaces](https://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [Generics](https://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Java Code Conventions](https://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
|
||||
|
||||
* Nouvelles fonctionnalités Java 8 :
|
||||
* [Lambda expressions (functional programming)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [Date and time API (java.time package)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
**Pratiquer en ligne et tutoriels**
|
||||
### Pratiquer en ligne et tutoriels:
|
||||
|
||||
* [Learneroo.com - Learn Java](http://www.learneroo.com)
|
||||
|
||||
* [Codingbat.com](http://codingbat.com/java)
|
||||
|
||||
**Livres** :
|
||||
### Livres :
|
||||
|
||||
* [Head First Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
|
||||
* [Thinking in Java](https://www.amazon.com/Thinking-Java-4th-Bruce-Eckel/dp/0131872486/)
|
||||
|
||||
* [Objects First with Java](https://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/0132492660)
|
||||
|
||||
* [Java The Complete Reference](https://www.amazon.com/gp/product/0071606300)
|
||||
|
@ -763,38 +763,30 @@ public class CobaEnum {
|
||||
Link-link berikut hanya menyediakan pemahaman lebih lanjut mengenai topik diatas.
|
||||
Tip, trik, dan contoh lainnya dapat melakukan pencarian melalui Google atau mesin pencari yang lain.
|
||||
|
||||
**Panduan resmi Oracle**
|
||||
### Panduan resmi Oracle:
|
||||
|
||||
* [Java Tutorial Trail from Sun / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Java Access level modifiers](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [Object-Oriented Programming Concepts](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Inheritance](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Polymorphism](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Abstraction](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Exceptions](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Interfaces](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
|
||||
* Fitur baru di Java 8:
|
||||
* [Lambda expressions (functional programming)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [Date and time API (java.time package)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
**Tutorial dan Praktik Online**
|
||||
### Tutorial dan Praktik Online:
|
||||
|
||||
* [Learneroo.com - Learn Java](http://www.learneroo.com)
|
||||
|
||||
* [Codingbat.com](http://codingbat.com/java)
|
||||
|
||||
|
||||
**Buku**:
|
||||
### Buku:
|
||||
|
||||
* [Head First Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
|
||||
* [Thinking in Java](https://www.amazon.com/Thinking-Java-4th-Bruce-Eckel/dp/0131872486/)
|
||||
|
||||
* [Objects First with Java](http://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/0132492660)
|
||||
|
||||
* [Java The Complete Reference](http://www.amazon.com/gp/product/0071606300)
|
||||
|
@ -536,38 +536,29 @@ class ClasseEsempio extends AltraClasse implements PrimaInterfaccia, SecondaInte
|
||||
|
||||
I link di seguito sono solo per capire l'argomento, cerca pure su Google degli esempi specifici
|
||||
|
||||
|
||||
**Guida ufficiale di Oracle [solo in inglese]**:
|
||||
### Guida ufficiale di Oracle [solo in inglese]:
|
||||
|
||||
* [Java Tutorial Trail from Sun / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Java Access level modifiers](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [Object-Oriented Programming Concepts](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Inheritance](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Polymorphism](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Abstraction](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Exceptions](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Interfaces](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconv-138413.html)
|
||||
* Nuove funzionalità in Java 8:
|
||||
* [Lambda expressions (functional programming)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [Date and time API (java.time package)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
|
||||
**Tutorial Online [in inglese]**
|
||||
### Tutorial Online [in inglese]:
|
||||
|
||||
* [Learneroo.com - Learn Java](http://www.learneroo.com)
|
||||
|
||||
* [Codingbat.com](http://codingbat.com/java)
|
||||
|
||||
### Libri [in italiano]:
|
||||
|
||||
**Libri [in italiano]** :
|
||||
|
||||
* [Java la guida completa](http://www.amazon.it/Java-guida-completa-Herbert-Schildt/dp/8838667667/ref=sr_1_1?ie=UTF8&qid=1393422296&sr=8-1&keywords=java)
|
||||
|
||||
* [Thinking in java](http://www.amazon.it/Thinking-Java-1-Bruce-Eckel/dp/8871923030/ref=sr_1_8?ie=UTF8&qid=1393422296&sr=8-8&keywords=java)
|
||||
|
||||
* [Manuale di Java 7](http://www.amazon.com/gp/product/0071606300)
|
||||
* [Java la guida completa](http://www.amazon.it/Java-guida-completa-Herbert-Schildt/dp/8838667667)
|
||||
* [Thinking in java](http://www.amazon.it/Thinking-Java-1-Bruce-Eckel/dp/8871923030)
|
||||
* [Java: The Complete Reference, 13a edizione](https://www.amazon.it/Java-Reference-Thirteenth-Herbert-Schildt/dp/1265058431)
|
||||
|
@ -1060,7 +1060,7 @@ The links provided here below are just to get an understanding of the topic, fee
|
||||
|
||||
### Books
|
||||
|
||||
* [Head First Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
* [Head First Java](https://www.oreilly.com/library/view/head-first-java/9781492091646/)
|
||||
* [Thinking in Java](https://www.amazon.com/Thinking-Java-4th-Bruce-Eckel/dp/0131872486/)
|
||||
* [Objects First with Java](https://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/0132492660)
|
||||
* [Java The Complete Reference](https://www.amazon.com/gp/product/0071606300)
|
||||
* [Objects First with Java](https://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/1292159049/)
|
||||
* [Java The Complete Reference](https://www.amazon.com/Java-Complete-Reference-Thirteenth-dp-1265058431/dp/1265058431)
|
||||
|
@ -387,21 +387,18 @@ class PennyFarthing extends Bicycle {
|
||||
|
||||
다음 링크를 통해 다양한 주제를 이해하고 구글을 통해 구체적인 예제들을 찾아보세요.
|
||||
|
||||
공부할 만한 기타 주제:
|
||||
### 공부할 만한 기타 주제
|
||||
|
||||
* [썬/오라클의 자바 자습서](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [자바 접근 제한자](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [객체 지향 프로그래밍 개념](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [상속(Inheritance)](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [다형성(Polymorphism)](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [추상화(Abstraction)](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [예외(Exceptions)](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [인터페이스(Interfaces)](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [제네릭(Generics)](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [자바 코딩 관례(Java Code Conventions)](http://www.oracle.com/technetwork/java/codeconv-138413.html)
|
||||
* Java 8의 새로운 기능
|
||||
* [람다 표현식 (Lambda expressions (functional programming))](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [날짜 및 시간 API (Date and time API (java.time package))](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
@ -627,7 +627,7 @@ public class EnumTeste {
|
||||
|
||||
Os links fornecidos aqui abaixo são apenas para ter uma compreensão do tema, use o Google e encontre exemplos específicos.
|
||||
|
||||
Outros tópicos para pesquisar:
|
||||
### Outros tópicos para pesquisar:
|
||||
|
||||
* [Tutorial Java para Sun Trail / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
* [Modificadores de acesso do Java](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
@ -639,12 +639,15 @@ Outros tópicos para pesquisar:
|
||||
* [Interfaces](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
* [Tipos Genéricos](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
* [Conversões de código Java](http://www.oracle.com/technetwork/java/codeconv-138413.html)
|
||||
* Novos recursos no Java 8:
|
||||
* [Expressões lambda (programação funcional)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [API de data e hora (pacote java.time)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
Livros:
|
||||
### Livros:
|
||||
|
||||
* [Use a cabeça, Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
|
||||
Apostila:
|
||||
### Apostila:
|
||||
|
||||
* [Java e Orientação a Objetos](http://www.caelum.com.br/apostila-java-orientacao-objetos/)
|
||||
* [Java para Desenvolvimento Web](https://www.caelum.com.br/apostila-java-web/)
|
||||
|
@ -4,6 +4,7 @@ contributors:
|
||||
- ["Vincent van Wingerden", "https://github.com/vivanwin"]
|
||||
- ["Mariia Mykhailova", "https://github.com/tcNickolas"]
|
||||
- ["Andrew Ryan Davis", "https://github.com/AndrewDavis1191"]
|
||||
- ["Alex Hansen", "https://github.com/sezna"]
|
||||
filename: LearnQSharp.qs
|
||||
---
|
||||
|
||||
@ -19,13 +20,14 @@ Q# is a high-level domain-specific language which enables developers to write qu
|
||||
// The most important part of quantum programs is qubits.
|
||||
// In Q# type Qubit represents the qubits which can be used.
|
||||
// This will allocate an array of two new qubits as the variable qs.
|
||||
using (qs = Qubit[2]) {
|
||||
operation QuantumDataTypes() : Unit {
|
||||
use qs = Qubit[2];
|
||||
|
||||
// The qubits have internal state that you cannot access to read or modify directly.
|
||||
// You can inspect the current state of your quantum program
|
||||
// if you're running it on a classical simulator.
|
||||
// Note that this will not work on actual quantum hardware!
|
||||
DumpMachine();
|
||||
Std.Diagnostics.DumpMachine();
|
||||
|
||||
// If you want to change the state of a qubit
|
||||
// you have to do this by applying quantum gates to the qubit.
|
||||
@ -58,6 +60,7 @@ using (qs = Qubit[2]) {
|
||||
/////////////////////////////////////
|
||||
// 2. Classical data types and operators
|
||||
|
||||
function ClassicalDataTypes() : Unit {
|
||||
// Numbers in Q# can be stored in Int, BigInt or Double.
|
||||
let i = 1; // This defines an Int variable i equal to 1
|
||||
let bi = 1L; // This defines a BigInt variable bi equal to 1
|
||||
@ -68,7 +71,7 @@ let n = 2 * 10; // = 20
|
||||
// Q# does not have implicit type cast,
|
||||
// so to perform arithmetic on values of different types,
|
||||
// you need to cast type explicitly
|
||||
let nd = IntAsDouble(2) * 1.0; // = 20.0
|
||||
let nd = Std.Convert.IntAsDouble(2) * 1.0; // = 20.0
|
||||
|
||||
// Boolean type is called Bool
|
||||
let trueBool = true;
|
||||
@ -98,20 +101,23 @@ mutable xii = true;
|
||||
set xii = false;
|
||||
|
||||
// You can create an array for any data type like this
|
||||
let xiii = new Double[10];
|
||||
let xiii = [0.0, size = 10];
|
||||
|
||||
// Getting an element from an array
|
||||
let xiv = xiii[8];
|
||||
|
||||
// Assigning a new value to an array element
|
||||
mutable xv = new Double[10];
|
||||
set xv w/= 5 <- 1;
|
||||
mutable xv = [0.0, size = 10];
|
||||
set xv w/= 5 <- 1.0;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// 3. Control flow
|
||||
|
||||
// If structures work a little different than most languages
|
||||
operation ControlFlow() : Unit {
|
||||
let a = 1;
|
||||
// If expressions support a true branch, elif, and else.
|
||||
if (a == 1) {
|
||||
// ...
|
||||
} elif (a == 2) {
|
||||
@ -119,14 +125,15 @@ if (a == 1) {
|
||||
} else {
|
||||
// ...
|
||||
}
|
||||
use qubits = Qubit[2];
|
||||
|
||||
// Foreach loops can be used to iterate over an array
|
||||
for (qubit in qubits) {
|
||||
// For loops can be used to iterate over an array
|
||||
for qubit in qubits {
|
||||
X(qubit);
|
||||
}
|
||||
|
||||
// Regular for loops can be used to iterate over a range of numbers
|
||||
for (index in 0 .. Length(qubits) - 1) {
|
||||
for index in 0..Length(qubits) - 1 {
|
||||
X(qubits[index]);
|
||||
}
|
||||
|
||||
@ -136,18 +143,18 @@ while (index < 10) {
|
||||
set index += 1;
|
||||
}
|
||||
|
||||
let success_criteria = true;
|
||||
// Quantum equivalent of a while loop is a repeat-until-success loop.
|
||||
// Because of the probabilistic nature of quantum computing sometimes
|
||||
// you want to repeat a certain sequence of operations
|
||||
// until a specific condition is achieved; you can use this loop to express this.
|
||||
repeat {
|
||||
// Your operation here
|
||||
}
|
||||
until (success criteria) // This could be a measurement to check if the state is reached
|
||||
} until (success_criteria) // This could be a measurement to check if the state is reached
|
||||
fixup {
|
||||
// Resetting to the initial conditions, if required
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// 4. Putting it all together
|
||||
@ -169,20 +176,21 @@ operation ApplyXGateCA (source : Qubit) : Unit is Adj + Ctl {
|
||||
|
||||
|
||||
// To run Q# code, you can put @EntryPoint() before the operation you want to run first
|
||||
@EntryPoint()
|
||||
operation XGateDemo() : Unit {
|
||||
using (q = Qubit()) {
|
||||
use q = Qubit();
|
||||
ApplyXGate(q);
|
||||
}
|
||||
}
|
||||
|
||||
// Here is a simple example: a quantum random number generator.
|
||||
// We will generate a classical array of random bits using quantum code.
|
||||
@EntryPoint()
|
||||
operation QRNGDemo() : Unit {
|
||||
mutable bits = new Int[5]; // Array we'll use to store bits
|
||||
using (q = Qubit()) { // Allocate a qubit
|
||||
for (i in 0 .. 4) { // Generate each bit independently
|
||||
// Callables (functions or operations) named `Main` are used as entry points.
|
||||
operation Main() : Unit {
|
||||
mutable bits = [0, size = 5]; // Array we'll use to store bits
|
||||
use q = Qubit();
|
||||
{
|
||||
// Allocate a qubit
|
||||
for i in 0..4 {
|
||||
// Generate each bit independently
|
||||
H(q); // Hadamard gate sets equal superposition
|
||||
let result = M(q); // Measure qubit gets 0|1 with 50/50 prob
|
||||
let bit = result == Zero ? 0 | 1; // Convert measurement result to integer
|
||||
@ -196,9 +204,6 @@ operation QRNGDemo() : Unit {
|
||||
|
||||
## Further Reading
|
||||
|
||||
The [Quantum Katas][1] offer great self-paced tutorials and programming exercises to learn quantum computing and Q#.
|
||||
The Quantum Katas ([repo](https://github.com/microsoft/qsharp/tree/main/katas) [hosted tutorials](https://quantum.microsoft.com/en-us/tools/quantum-katas) offer great self-paced tutorials and programming exercises to learn quantum computing and Q#.
|
||||
|
||||
[Q# Documentation][2] is official Q# documentation, including language reference and user guides.
|
||||
|
||||
[1]: https://github.com/microsoft/QuantumKatas
|
||||
[2]: https://docs.microsoft.com/quantum/
|
||||
[Q# Documentation](https://docs.microsoft.com/quantum/) is official Q# documentation, including language reference and user guides.
|
||||
|
@ -493,38 +493,29 @@ public class ExampleClass extends ExampleClassParent implements InterfaceOne, In
|
||||
|
||||
Здесь приведены ссылки только для того, чтобы получить общее представление о Java. Гуглите, чтобы найти какие-либо конкретные примеры.
|
||||
|
||||
**Официальные руководства Oracle**:
|
||||
### Официальные руководства Oracle:
|
||||
|
||||
* [Java Tutorial Trail from Sun / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Модификаторы доступа в Java](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [Концепции объектно-ориентированного программирования](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Наследование](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Полиморфизм](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Абстракция](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Исключения](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Интерфейсы](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [Generics](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Java Code Conventions](http://www.oracle.com/technetwork/java/codeconv-138413.html)
|
||||
* Новые возможности Java 8
|
||||
* [Лямбда-выражения (функциональное программирование)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [API даты и времени (пакет java.time)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
**Уроки онлайн**
|
||||
### Уроки онлайн
|
||||
|
||||
* [Learneroo.com - Изучение Java](http://www.learneroo.com)
|
||||
|
||||
* [Codingbat.com](http://codingbat.com/java)
|
||||
|
||||
|
||||
**Книги**:
|
||||
### Книги
|
||||
|
||||
* [Head First Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
|
||||
* [Objects First with Java](http://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/0132492660)
|
||||
|
||||
* [Java The Complete Reference](http://www.amazon.com/gp/product/0071606300)
|
||||
|
||||
|
||||
|
@ -746,38 +746,30 @@ public class EnumTest {
|
||||
|
||||
Посилання, наведені нижче, дозволяють тільки зрозуміти тему. Щоб знайти конкретні приклади, використовуйте Ґуґл.
|
||||
|
||||
**Офіційні посібники Oracle**:
|
||||
### Офіційні посібники Oracle:
|
||||
|
||||
* [Посібник Java від Sun / Oracle](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Java — модифікатори доступу](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [ООП-концепції](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [Наслідування](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [Поліморфізм](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [Абстракція](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [Виключення](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [Інтерфейси](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [параметризація](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Стиль коду у Java](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
|
||||
* Нові функції в Java 8:
|
||||
* [Лямбда-вирази (функціональне програмування)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [API дати та часу (пакет java.time)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
||||
**Online-практика та посібники**
|
||||
### Online-практика та посібники:
|
||||
|
||||
* [Learneroo.com — Вивчаємо Java](http://www.learneroo.com)
|
||||
|
||||
* [Codingbat.com](http://codingbat.com/java)
|
||||
|
||||
|
||||
**Книжки**:
|
||||
### Книжки:
|
||||
|
||||
* [Head First Java](http://www.headfirstlabs.com/books/hfjava/)
|
||||
|
||||
* [Thinking in Java](https://www.amazon.com/Thinking-Java-4th-Bruce-Eckel/dp/0131872486/)
|
||||
|
||||
* [Objects First with Java](http://www.amazon.com/Objects-First-Java-Practical-Introduction/dp/0132492660)
|
||||
|
||||
* [Java The Complete Reference](http://www.amazon.com/gp/product/0071606300)
|
||||
|
@ -386,21 +386,18 @@ class PennyFarthing extends Bicycle {
|
||||
|
||||
下面的链接只是为了便于大家理解这些主题而给出的,对于具体的例子请大家自行Google
|
||||
|
||||
其他主题:
|
||||
### 其他主题:
|
||||
|
||||
* [Java 官方教程](http://docs.oracle.com/javase/tutorial/index.html)
|
||||
|
||||
* [Java 访问修饰符](http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html)
|
||||
|
||||
* [面向对象程序设计概念](http://docs.oracle.com/javase/tutorial/java/concepts/index.html):
|
||||
* [继承](http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html)
|
||||
* [多态](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)
|
||||
* [抽象](http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html)
|
||||
|
||||
* [异常](http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html)
|
||||
|
||||
* [接口](http://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html)
|
||||
|
||||
* [泛型](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
|
||||
|
||||
* [Java代码规范](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)
|
||||
* Java 8 中的新特性:
|
||||
* [Lambda 表达式(函数式编程)](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html)
|
||||
* [日期和时间 API(java.time 包)](http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html)
|
||||
|
Loading…
Reference in New Issue
Block a user